Auto numbers

  • Thread starter Thread starter abumustapha
  • Start date Start date
A

abumustapha

I am creating a table where I need to set up an auto number field and set
this number to be my key. How can I set that field to start at a specific
number ( ie: 2000)
thank you
 
If you are using an autonumber for something meaningful, I would HIGHLY (make
that EXTREMELY) suggest that you do not. Autonumbers are guaranteed to give
you a unique number but they are not guaranteed to be consecutive nor even
positive. If you need a number with meaning, I would still use the
autonumber as the primary key but create your own number to use for people to
view.


--
Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP

Tutorials at http://www.btabdevelopment.com

__________________________________
 
I am creating a table where I need to set up an auto number field and set
this number to be my key. How can I set that field to start at a specific
number ( ie: 2000)
thank you

Bob's right. Autonumbers are not designed and are not suitable for
this purpose, unless you are uncommonly tolerant of numbering gaps.

Deleting a record in an Autonumbered table will leave a permanent gap
at that record's autonumber value. So will just starting to enter a
record and hitting the <Esc> key to cancel. Running an Append query
will usually leave a gap, sometimes a huge one (you might have
consecutive records 2120, 2121, 35500, 35501). Replicating your
database will make your autonumbers random - +1182245131 might be
frollowed by -928751442.

If you want sequential, human-meaningful numbers use a Long Integer
field in the table, and fill it yourself, programmatically. Do a
Google Groups search of this newsgroup for "Custom Counter" or
"Autonumber" to find numerous examples - http://groups.google.com and
choose Advanced Search, searching microsoft.public.access.*.
 

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

Back
Top