autonumber

A

Aten

How do I make sure that autonumber always starts from 1?
I've created a database, practised entering data, didn't
like it, altered the form etc, and then tried again. Now
thta my db is up and running, some forms start at eg. no
15, some at 21, depending on how many times i've tested
it. Now I need them all back at 1!! How do I do this? I
know there is a way of forcing the number to start at a
number other than one, but all i'm looking for is in
effect a reset button
 
J

John Vinson

How do I make sure that autonumber always starts from 1?

You don't.

An autonumber has one function and ONE FUNCTION ONLY: providing an
almost-guaranteed unique key. They will always have gaps in a live
system; not only does deleting a record leave a gap, but even just
hitting <Esc> to cancel an addition. Autonumbers should be kept "under
the hood" and never presented to users.

If you want a sequential number starting at 1 and incrementing without
gaps, use a Long Integer field and write VBA code in the Form you're
using to enter your data to increment it.
 
T

TC

What will you do when your users:

o start entering a new record;
o give up by pressing Esc a few times, without saving; then,
o repeat the process a few times?

Try it yourself, & see what happens to the autonumbers!

In general, you can not assume that production autonumbers will go 1, 2, 3
etc. You might get gaps in the middle. One way this happens, is shown above.
This isn't a bug, it is how they work.

HTH,
TC
 

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