serial number in Access

S

studentmptc

How do I get Access to generate and display a unique number for each new
record I enter?
 
N

Naresh Nichani MVP

Hi:

Access has a field type called AutoNumber which automatically increments
count by 1.

However AutoNumber will not always give the next number - for example you
start adding a new record and deicde to cancel - the AutoNumber used in that
record will be lost. For example you have 2 records are adding record 3 -
the AutoNumber will be 3 - however if you do not save the record and cancel
out the Autonumber 3 will be lost and you will get 4 next.

If you need a better approach then you should think of VBA code to assign a
unqiue number when you save the record.

Regards,

Naresh Nichani
Microsoft Access MVP
 
M

madhivanan2001

Instead you use this

When inserting a new record, find the maximum of Id and add 1 to it and
save the record

Madhivanan
 
Top