How can I start Autonumber with 0001 in MS Access

B

Bambi

So what are those ways? She obviously needs the number for a particular
reason in Access, so please assist?
 
J

John Vinson

So what are those ways? She obviously needs the number for a particular
reason in Access, so please assist?

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

John W. Vinson[MVP]
 
Top