Full Version: SQL Insert Statement Resetting Autonumber valud
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
NeoJeff
I used a SQL Statement to insert a record into an existing table. When I added a the new record, I set the Keyfield (which is defined as AutoNumber) to -1. I did this because I need to be able to trask this in my customers database. The user can also add records to this table.

Once I add this record, my next value for the autonumber is 0. Knowing this, I have two questions:

1. Is there anyway to do what I did and NOT have it reset the autonumber?
2. Is there anyway from code to reset the next value once it's messed up. I know I can open the database and copy/paste the table (or import it) to reset it.

Jeff
Jack Cowley
I would not mess with autonumbers as they are meant only to provide a unique way for Access to identify every record. You might want to consider adding a boolean field to your table and then check the record you want so you can identify it later.

Autonumbers are not meant to be used by humans but are strictly for Access to identify records. If you are trying to use autonumbers in any other way then you need to reconsider how you are keeping track of your records.

hth,
Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.