values in the AutoNumber field are not sequential, why?

J

jeffhill

While entering records into database, I entered the same record two times. I
deleted the record with the duplicate information and then added a new
record. Now the values in the AutoNumber field are not sequential. How can
this be?
 
S

Steve

At the first data entry keystroke of a new record, Access assigns the
autonumber which is the highest existing autonumber +1. Access never goes
back and trys to assign a missing autonumber. When you delete a record,
Access deletes the assigned autonumber and that number is gone forever never
to be reused.

Steve
(e-mail address removed)
 
R

Richard

Auto numbers are meant to increment, but not necessarily are sequential.

Richard
 
F

fredg

While entering records into database, I entered the same record two times. I
deleted the record with the duplicate information and then added a new
record. Now the values in the AutoNumber field are not sequential. How can
this be?

That's the way AutoNumbers work. Once a number is assigned to a new
record, if you delete that record that number is not re-used. Even
without deleting a record, AutoNumbers are only required to be unique,
not sequential, and gaps can occur.
If, for some reason, you need to have a sequential number, you'll have
to create your own system. But again, once you delete a record, let's
say record #54 out of a sequence of 1 to 100, you will still have a
missing number.
 
D

Douglas J. Steele

In addition to what everyone else has told you, why does it matter?

The only reason for an AutoNumber field is to provide a (practically
guaranteed) unique value that can be used as a primary key. 231, 233, 234
serves that need just as well as 1, 2, 3. If the value of the AutoNumber
field matters to you, you probably shouldn't be using an AutoNumber field.
 
D

David W. Fenton

Auto numbers are meant to increment, but not necessarily are
sequential.

Long integer Autonumbers can be sequential or random. They are
sequential by default. They can also be "ReplicationID" instead of
long integer, in which case they are neither sequential nor random.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top