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

import text file, create primary key

Status
Not open for further replies.

impulse24

IS-IT--Management
Jul 13, 2001
167
0
0
US
Hi,

I plan to import a text file daily into a Microsoft Access 2000 database.

The access table has fields:

ID, Name, SSN, Date of Birth

The text file has fields:
Name, SSN, Date of Birth

When I import the text file, the name is put into the id field. The id field is an autonumber field. How do I import the file but have the name go into the name field, and have the id field increment the autonumber. Any help would be appreciated.
 
Impulse

What I tend to do is,
1) Create a Main table to store the required data in which has the IDfield set to autonumber.

2) Import my file in to a separate 'Feed' table without any ID field.

3) Have an Append query to add the records from the Feed table to the 'Main' table, as the new records are appended the ID field will be populated by the autonumber.

All this can be coded to a command button so that it happens without user intervention. It just depends how far you wish/need to take it.

PassingBy
 
I would try attaching the text file and doing an append query rather than importing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top