How to generate auto increment invoice number

  • Thread starter Thread starter AccessNovice
  • Start date Start date
A

AccessNovice

Is it possible to generate auto increment invoice number where we
already have existing records. If it is possible, how?

Also, this database will be hosted on a website and accessed by 2 or
more users - at times simultaneously.

Please explain step-by-step as I am very new to Access.


Thank you, thank you, thank you in advance.
 
You can look at the existing table, find the highest value using the DMax()
function, then add 1 to it and immediately save the record so that you are
less likely to conflict with another user.

The code for a new record is simple (aircode):

Sub Form_Current()
If Me.NewRecord = True Then
Me.txtIDField = DMax("IDField", "TableName")
End If
End Sub
 
Back
Top