Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TransferText error

Status
Not open for further replies.

GerryGoldberg

Technical User
Apr 12, 2001
55
I am trying to import a text file into an existing empty A97 table and continue to get an error. The VB code is:

docmd.TransferText acImportDelim,,"tblA","c:\txt\tblA.txt",false

The error I get is:
"Field F1 doesn't exist in destination table tblA"

This is true, except I thought that the TransferText method appended to the existing fields of the destination table. What am I doing wrong?

Thanks,

Gerry Goldberg
 
You need to either delete the table or setup an Import Specification. You then declare the specification name within your code above. You save your spec during a manual import of the text file by clicking on the 'Advanced' button once you`ve completed all option screens and choose 'save as'.

Hope this helps.

Ian
 
I'd go with the deleting the table option - it's FAR easier! :) I had exactly the same problem the other day, and that's how I got around it.
 
With the simple deletion method, it depends on whether you want to have certain Field formats etc after the import has taken place. Other option if you want, is to name all the fields in the existing table as the defaults of 'field1', field2 etc. As long as they match the names the imnport is tryting to create you`ll have no problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top