You can also make an autonumber on table level by setting the column type to Autonumber
From the link I provided;Ok, I don't understand the ''Criteria''
DMax ( expression, domain, [criteria] )
I've got expression and domain. what's the criteria referring to? and why is it a number and what for?
criteria is optional. It is the WHERE clause to apply to the domain.
="TAX INVOICE #M1" & (Nz(DMax("INV","InvoiceNumber")+1))
="TAX INVOICE #M1" & (Nz(DMax("INV","InvoiceNumber"),666)+1)
If Me.Counter = 0 Then
Me.Counter = Nz(DMax("Counter", "Table1"), 9910079) + 1
End If