Import Specification MS Access

I'm trying to set up an Import Specification so that I can reference it in VB code to import a text file into an Access table.

My Access table has field names.  My text file does not have field names.

I did the following:

File/Get External Data/Import
I clicked on text file, selected Delimited (by TAB)
I clicked Advanced
I clicked Save As and gave it a name

When I reference the name in my code, I get an error "Field 'Field1' doesn't exist in destination table 'MyTable.'

Any way around this since my Access table has field names but my text files doesn't?
Who is Participating?
Don ThomsonCommented:
If you are importing any file into an existing table or even into a new table - it has to have field names. Even if the first row of imported data doesn't have them.

IF you do a manual import of a text file without the headers, then you need to put them in during the import. Once you have named the fields goto the advanced tab or put the names in within the advanced tab - Then Save it

Every field that you want to import into your table must match a field name exactly in your table. If you have data you don't need to import into the table - check the skip button
Rey Obrero (Capricorn1)Commented:
did you specify in the import specification that first row is not field names?

in the second window, there is a check box labeled First Row Contains Field Names
 you must uncheck this
dbfromnewjerseyAuthor Commented:
I left the "First Row Contains Field Names" checkbox blank.   I selected my delimeter and then clicked the Advance button.  When I'm in the Advanced window, the leftmost column is Field Name with field names "Field1", "Field2", etc below it.  I thought by leaving the checkbox blank that that meant no field names. But in Advanced, default ones are showing up.
Rey Obrero (Capricorn1)Commented:
in the import specification you have specify the field names that are in your table to correspond for each field in the text file
dbfromnewjerseyAuthor Commented:
Thank you very much, DHT.  Got it working.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.