insert missing numbers in autonumber field

G

Guest

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.
 
J

Joseph Meehan

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

I suggest you may not want to use Autonumber for that use. Autonumbers are
designed to provide unique numbers. It in not designed to provide numbers
in order and for a number of reasons may not do so. As a result using them
in any application where the user sees the numbers is likely to end up with
confusion.

There are other ways of providing the numbers you want depending on the
particual application.
 
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
 

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