Using VBA code to import tab delimited text data

championss

New member
Local time
Today, 01:49
Joined
Oct 30, 2006
Messages
1
I have a table by name "newtab" and I was trying to import a tab delimited text file "newdata.txt" into newtab. The first line in the text file are the column names: SSN, Lastname, FirstName (all tab delimited though). The same field names exist in the destination file. However I am getting the error which says the "the field name SSN Lastname FirstName does not exist in the destination file" What could possibly be the problem? Since the field names are not separated in the error message, could it be that it is seeing all 3 field names as one and therefore cannot match them to the destination fields? Does that mean TAB cannot be used as the delimiter? Using the interactive IMPORT from access directly for the same files work really good though. However, I would like to do this programmatically since the files would be coming in weekly for me to load and they are many such files. The command I used is as below. Please I need help.

DoCmd.TransferText cImportDelim, , "newtab", "c:\reports\newdata.txt", True
 
do it manually the first time, and save an import spec (advanced tab) - its much easier to manage imports that way.

you can still use the transfer text command, slightly modified.
 

Users who are viewing this thread

Back
Top Bottom