P
Peter Hibbs
Access 2003
Table tblInvoices has field InvoiceNo (amongst others) which is type
Number (Long), Indexed property = Yes (No Duplicates) and is PK.
Using this code in the button which creates a new invoice -
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
InvoiceNo = DMax("InvoiceNo", "tblInvoices") + 1
.... (more code)
....
No problem so far.
This DB is being used on a LAN with BE on main PC and FEs on six other
PCs where any user could create a new invoice record at any time.
Now Sods Law states that if it is possible for two users to create two
invoices with the *same* invoice number, it will happen one day
(probably 3 years down the line when I have forgotten all about it).
Is there any way (other than making the InvoiceNo field unique) to
ensure that Access will not allocate the same number if two users
click the button in the same millisecond or will Access throw up an
error in this case?
Peter Hibbs.
Table tblInvoices has field InvoiceNo (amongst others) which is type
Number (Long), Indexed property = Yes (No Duplicates) and is PK.
Using this code in the button which creates a new invoice -
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
InvoiceNo = DMax("InvoiceNo", "tblInvoices") + 1
.... (more code)
....
No problem so far.
This DB is being used on a LAN with BE on main PC and FEs on six other
PCs where any user could create a new invoice record at any time.
Now Sods Law states that if it is possible for two users to create two
invoices with the *same* invoice number, it will happen one day
(probably 3 years down the line when I have forgotten all about it).
Is there any way (other than making the InvoiceNo field unique) to
ensure that Access will not allocate the same number if two users
click the button in the same millisecond or will Access throw up an
error in this case?
Peter Hibbs.