This question already has an answer here:
I have a INSERT INTO ... SELECT
statement that copies data from one table to another.
The thing though is, the AutoNumber column value in the second table started from the last number in the first one.
Meaning the count of first table is 2000, then, the second table started from 2001.
Using an Access database, how to reset this value?
Looks like your only option is to move the data into a new table. The following link has some information about how to do it based on your version of access.
Note: be careful if you have relationships to other tables as those would need to be recreated.
http://support.microsoft.com/kb/812718
You can execute an Access DDL statement from ADO to reset the autonumber seed value. Here is an example Immediate window session:
The statement must be executed from ADO. It will fail if you try it with DAO (such as
CurrentDb.Execute strDdl
), or from the Access query designer. The example succeeded becauseCurrentProject.Connection
is an ADO object.The two values following
COUNTER
are seed and increment. So if I wanted the autonumber to start from 1000 and increment by 2, I could useCOUNTER(1000, 2)
If the table contains data, the seed value must be greater than the maximum stored value. If the table is empty when you execute the statement, that will not be an issue.
I ran across this little tid bit of info on how to set the value of a Microsoft Access AutoNumber Field.
It worked for me find. Just follow the instructions to the letter. Not like me skipping around though it. I found out the hard way to do exactly as it says. I hope it'll help you out if I read your question right. I restart the autonumber field to 4556363 with a table with 8500 records in it and it didn't alter anything, just the autonumber field. I hope this ain't to late to help. Steven