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?
dbfromnewjerseyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
0
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.
0
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
0
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dbfromnewjerseyAuthor Commented:
Thank you very much, DHT.  Got it working.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.