We help IT Professionals succeed at work.

Access 2003 Auto number does not increment after adding a new record

989 Views
Last Modified: 2008-01-09
Access 2003.  Ihave a Form, and a command button to add a new record.  When I click on it , it creates a new record.  However, the autonumber does not increment to the next number, eventhough the status bar at the bottom shows that a new record has been added.  How do I force it in code after creating new recommand syntax to show the next record number.
I have a docmd.save and also a me.refresh after the add new record command syntax in the code, but it still not does not show the next number.  thanks.
Comment
Watch Question

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
Note that 'record numbers' in the status bar are not directly related to Auto Numbers per se ... nor will they necessarily be in sync.

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
"However, the autonumber does not increment to the next number"

The next AN will not be created until the New record becomes "dirty' ... ie ... at least one *bound* field has a new value entered into it.

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
In general, You should not depend on the AN for anything other than maybe a 'reference' number ... which may or may not end up being sequential. AN's can have gaps ... for many reasons.

mx
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.