Solved

I am having trouble Exporting from an Access Table to a Text File - Ihave created an Export Specification that works manually in Access, but my VBA Code Complains with a Run-time error '3442'

Posted on 2006-07-10
6
448 Views
Last Modified: 2012-05-05
I am trying to automate the exporting of some data from a Table to a Test File. The data is actually created by a Query, but because I have some Memo fields of more than 255 characters, I have had to make the Query an Append Query, & my code firstly removes all Rows from the Table, then runs the Query to repopulate the Table.

If I Export the data from this Table manually, it works just fine, using the Export Specification I have created previously. However, if I run my VBA Code, I get the following error:

 "Run-time error '3442':

 In the text file specification 'ExportToTextFile', the ExtendedInfoText option is invalid."

Here is my VBA Code:

 DoCmd.TransferText acExport, "ExportToTextFile", "ExportToTextFile", "\\Ukenetsrv01\clients\Direct.com\Export.txt", True

The ExportToTextFile is the Export Specification I have previously created.

Any idea what's wrong here?

Thanks.
0
Comment
Question by:PaulCutcliffe
  • 3
  • 2
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17073502
Could it possibly be getting confused as your spec and source object have the same name?
Have u tried changing one of the names to something else to see what happens?

0
 

Author Comment

by:PaulCutcliffe
ID: 17073793
Yes, I've tried various names, but the result is the same.
0
 

Author Comment

by:PaulCutcliffe
ID: 17074124
If I remove one of the last two columns (quite big, come from Memo fields), then it exports perfectly, using my same VBA Code.

Are there limits that somehow only apply to these Export Specifications, but only when used in Code?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 250 total points
ID: 17074663
According to Access help, you are supposed to use acExportFixed, acExportDelim, acExportHTML, or acExportMerge as the transfer type.....and presented the following example:

TransferText Method Example
The following example exports the data from the Microsoft Access table External Report to the delimited text file April.doc by using the specification Standard Output:

DoCmd.TransferText acExportDelim, "Standard Output", _
    "External Report", "C:\Txtfiles\April.doc"


Assuming you have a delimited file, your syntax should be:

DoCmd.TransferText acExportDelim, "ExportToTextFile", "ExportToTextFile", "\\Ukenetsrv01\clients\Direct.com\Export.txt", True
0
 

Author Comment

by:PaulCutcliffe
ID: 17077770
puppydogbuddy: Excellent, that works a treat!

I hadn't spotted that, & even if I had, would probably have assumed that I didn't need to specify 'Delimited' there, as I was using an Export Specification that stated it was delimited, & it did work fine with just one less Memo field in.

Anyway, thanks for sorting that. :-)

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17077878
You are welcome.  Glad I could help.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now