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

Importing to Access table with autonumber primary key 1

Status
Not open for further replies.

IngDep

MIS
Feb 7, 2008
89
US
Is it possible to import a text file into a MS Access table that has a autonumber primary key field?

Have tried several times without much success.

What is the preferred method to import to a table with a autonumber primary key field?

 
Well, Additional information...

The text file has the following fields; DateOfService, AccountNo., LastName, FirstName

The MS Access table has the following fields; ContactId (AutoNumber), DateOfService, AccountNo., LastName, FirstName

 
Use a transitional table. Import the text into a table with ONLY the DateOfService, AccountNo, LastName, and FirstName fields. THEN use an APPEND query to move those over into the other table, remembering of course to NOT include the Autonumber field in the Append Query.

Bob Larson
Free Access Tutorials and Samples:
 
Thanks for the insight. Just created the transitional staging table and the append query.

The first run was not successful. Will review.

I assume that the autonumbering field will "automatically" populate when using the append query to "batch import" records.

Will the autonumbering be in sequence every time that this process is performed?

 
Autonumbers being in sequence should NOT matter to you, if you are using them correctly (to just identify a row of data by a unique means). If you care what the autonumbers are, you are not using them correctly.

Bob Larson
Free Access Tutorials and Samples:
 
Another thought... You could link to instead of importing your text file... This way you don't have datbase bloat from importing and presumably deleting the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top