invoiceID duplicates when 2 users key in the same time

  • Thread starter Syphonics via AccessMonster.com
  • Start date
S

Syphonics via AccessMonster.com

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?
 
D

Douglas J. Steele

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.
 
S

Syphonics via AccessMonster.com

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?

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.
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?
 

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.

Ask a Question

Top