I have this statement in my order form.
Before insert function:
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.InvoiceID = Nz(DMax("InvoiceID", "Orders"), 0) + 1
End Sub
This function will increase the invoice number each time I insert an order.
But there will be duplicates when 2 or more stations conicidently insert an
order at the same time.
I required this InvoiceID to be unique, no duplicates. Is there a way to
prevent duplicates?
Are you actually running into problems, or are you just afraid that you
might?
The probability of two people hitting Enter at exactly the same time is
usually extremely low, so that I wouldn't expect a problem to occur.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I have this statement in my order form.
> Before insert function:
[quoted text clipped - 10 lines]
> I required this InvoiceID to be unique, no duplicates. Is there a way to
> prevent duplicates?
Syphonics - 23 May 2008 09:38 GMT
Thanks, I guess I have to set the table properties to no duplicates.
>Are you actually running into problems, or are you just afraid that you
>might?
[quoted text clipped - 7 lines]
>> I required this InvoiceID to be unique, no duplicates. Is there a way to
>> prevent duplicates?