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
456 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

911 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

27 Experts available now in Live!

Get 1:1 Help Now