Get a field ID

Iemhoff

New member
Local time
Today, 01:38
Joined
Apr 3, 2025
Messages
1
docmd.transferspreadsheet acImport (access2002)




When i used this, i get my 'table' but without the field 'ID' (autom) this all in vba.

When i do it manual with Import, from either file.xls , file.csv or file.html ist work fine.
I get all data with a field ID.

The question, how insert a ID field in a file, read from file.??? with vba in access2002
 
Works for me?
The first time I imported, it created the table, so no autonumber.
I added an autonumber field and second import populated it?

488 records in the first sheet.
1743674541533.png
 
The ONLY way you can update an autonumber field is by using an append query. So, instead of importing using transferspradsheet, link the table and then run an append query.
 
docmd.transferspreadsheet acImport (access2002)




When i used this, i get my 'table' but without the field 'ID' (autom) this all in vba.

When i do it manual with Import, from either file.xls , file.csv or file.html ist work fine.
I get all data with a field ID.

The question, how insert a ID field in a file, read from file.??? with vba in access2002

Agree with what has already been posted.
So, your choices seem to be 1) establish a table first, with the ID field, then populate it. 2) go ahead and allow some process, like docmd.transferspreadsheet, to create + populate the table, after which point you'd need to use VBA and DAO to alter the table and add an ID field if you want to include this in the automated process.

Seems #1 would feel better to me if I were you
 

Users who are viewing this thread

Back
Top Bottom