When I create a new table, access automatically adds an auto number field labelled ID. How come it always starts at 2?
When I create a new table, access automatically adds an auto number field labelled ID. How come it always starts at 2?
I thought it always started at 1, but that does not matter. If you want it to start at another number, you can run an append query and write to the Autonumber field. There are a couple caveats. I believe it is as simple as not duplicating any Autonumber field that currently exists. I follow the rule of starting with a number that is greater than the largest number that existis in the table.
You can do a compact and repair to "reset" any reserved autonumbers that are not visible within the table. For instance, you create a record but do not commit it to the table or you delete the record. If that record had an Autonumber of 5, the number 5 will not be available unless you did a compact and repair, first.
Odd, mine always start at 1.
The missing number will be available and used after C&R if no other records were entered first.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Perhaps you have some attribute set -- it usually starts at 1 unless changed to a specific starting value or random assignment. Be cautious of autonumber, they are not necessarily incremental and not necessarily positive. They are only "guaranteed" to be unique.
See this for more info about autonumbers.
Did you have an original record in the table and delete it?? That would remove ID 1
We did not doubt you but never seen this happen and no idea why. AFAIK, would have had to delete record with ID 1.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I did not doubt your records are starting with 2. Is this not acceptable?
starting with 2 is fine. I was just curious, as I'm a novice, as to why it didn't do what I expected it to. When I just tried it and it did exactly what was expected it made me even more confused!
I'm heavily into excel and I'm finding the conversion to access a bit tougher than I expected. It's like living in a 2D world and suddenly finding yourself in a 3D world! Thank goodness I can ask you guys.
Access definitely has its nuances, but it does a lot for us so I try not to complain about how it behaves. I just try to remember what it likes to do.
For me, I probably would not have noticed 2 being a first record. If it was very obvious to you, you might want to review the link provided by orange in post #4. Just so you have a good idea when and how to use the Autonumber data type.
thanks everyone.