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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

txt file has no pk and the table needs one

Status
Not open for further replies.

smith7255

MIS
Apr 11, 2006
21
US
Hello -
I have a txt file that I need to import into a table in Access. I have created an import spec, but the file doesn't have a pk. I need one in the table but the file will not import (using a macro) because the fields are not the same. Now, I can do it manually because it asks me if I need on, specify my own or don't need one. That just creates an ID field in the table and the problem comes around again because the file doesn't match. How can I get a pk using autonumber on an import like this?
 
You can import into a temporary table and then append to a table that has an autonumber primary key.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thank you for your help, but I actually hid the ID column of that table and it was able to import. Although this does not work with exporting. I will just create a query that doesn't include the ID column and then export that instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top