I create autonumber as primary key in a table, then i tried to enter a record in that table. Then i deleted it, but when i enter a new record, auto number started with the next number. Ex: i enter a record and autonumber for it is 1. I deleted this record and entered a new record, but autonumber is 2. I want the number to be 1
I copied that from a page i found with google but i couldnt view the replies
the autonumber is operating correctly. its purpose is to generate a unique value that never repeats.
for the reason you have just described - it is not suitable as a visible 'numbering' method - only as a key field in the background.
your confusion is not unusual among new users. There is not in fact any simple embedded method to have a line numbering system - part of the reason is that users might sort a column/field alphabetically (that's an embedded feature of any db) and so the numbering would no longer be in order. Plus of course as you see if any record is deleted - are you going to trigger a query that renumbers every line??
The simplist thing is to add a number field and let the human enter the value. But with a little vba you can do a Max+1 technique so that the db auto enters the value - - which is suitable for the moment of data entry - - but still doesn't deal with the issue of what happens should a record be deleted and how to renumber everything....
note however over on the Report side - there is a line numbering technique that works when the report is generated....