autonumber not working

S

seeker

I have a form that is used to sign individuals in when they arrive and/or
leave. This form adds new records to a table. The primary key is
autonumber. The form is assigning a number that is already used and so does
not add record because of key violation. I have asked for the number that is
in the field id on the form in the immediate window and it is a number that
is already used. Why is this all of a sudden doing this. Why isn't
autonumber in table creating a max + 1 number
 
J

Jeff Boyce

First, you are operating under a mis-conception.

Access autonumbers are NOT guaranteed to be sequential ... so "max + 1" is
NOT what you'll (always) get.

Second, having an Autonumber field "re-using" numbers is an indication of a
potential corruption issue.

Make a backup (make 2, make 3!) of the file, then try running the Compact &
Repair feature. If it fails, you have backups to fall back on.

Also try searching with your favorite on-line search tools for "autonumber
repeating" to see what solutions other folks have found.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
R

Ron2006

Don't ASSIGN the value to the autonumber field. Simply display the
field (with it being 'locked').
When the record is created Access will show the number and it will be
the next value.

Ron
 

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