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.
One way is to use a Number... Long Integer for this field, instead of
any type of Autonumber.
Use a Form to do ALL data entry to the table. Have a textbox bound to
this ID field, let's call it txtID, with a Format property of "0000"
to force leading zeros (the number 1 and the number 0001 *are the same
number* just displayed differently).
In the Form's BeforeInsert event put code like:
Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtID = NZ(DMax("[ID]", "[tablename]")) + 1
End Sub
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.