insert missing numbers in autonumber field

M

mwdmanjg

some of the records were accidentally erased in a autonumber field, is it
possible to re-insert the missing numbers in the autonumber field?
 
D

Douglas J. Steele

Why? Because you don't want gaps, or because you need those same numbers
reused?

You should never attach any meaning to Autonumber fields: in fact, it's rare
that the user even sees them. Autonumber fields are intended to provide an
(almost guaranteed) unique value that can be used as a primary key. 23, 28,
31 fills that need as well as 3, 4, 5 does.

If it's critical that the same numbers be reused, try building a table
that's identical except that it's a Long Integer instead of the Autonumber
field. Populate that new table with the missing rows, putting the correct
numbers in the Long Integer field. Write an append query that puts the data
from your new table into your existing table.
 
L

Larry Daugherty

Hi,

Don't bother. If you are using the autonumber datatype for anything but
generating a unique number for use as a surrogate key you're asking for
trouble. To underscore the point, if you allow it to be SEEN by the users
your application you;re asking for trouble.

The Autonumber datatype isn't guaranteed to generate an unbroken sequence.

If you need to generate sequence numbers that are meaningful to humans you
must generate and manage those numbers yourself.

HTH
 
Top