As far as Access is concerned there is no difference between 1 and 0001 in
an AutoNumber field. You can, however, format the field to be displayed with
leading zeros. Put 0000 in the format section of your field in table
design.
You should not be using an AutoNumber field for anything other than
assuring that each record's ID is unique.
If you wish to assign an Invoice number in a consecutive fashion,
create your own InvoiceNum field.
You can make it Number datatype, Integer field size.
Then increment it on your form in the InvoiceNum control's Default
Value property:
Nz(DMax("[InvoiceNum]","TableName"),0) + 1
Others have already addressed the leading zero issue. Now about
autonumbers where you or anyone will be looking at the numbers. Be aware
that autonumber is designed to provide unique numbers. It is not designed
to produce consecutive numbers, although it will do it most of the time.
When people start looking at the list and see numbers missing or out of
order, they are going to think they have a problem.
You can create a system to give consecutive numbers if you like.
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.