Using MS Access/Multi-user databases
I have a question in regard to multi-user databases. My database will be split with the back-end on the server and the front-end on each user's computer. I have done this before and didn't have much issue. The only issue that I am concerned about is a collision between two or more users. The form that I am using has a sequential numbering system that seems to work perfectly (Thanks to your help!!) The user will open a form, choose a consignee number from a combo box, then choose the fiscal year from another combo just below it, then the user will click the command button to generate a new PO number. I have placed the following code in the on click event of the button. Should I have added anything further to ensure that an error won't appear in the case that two or more users click this button at exactly the same time. Here is the code:
If IsNull(Me.TXTFCODE) Then
MsgBox "Please enter the appropriate consignee code.", vbOKOnly
If IsNull(Me.TXTFYEAR) Then
MsgBox "Please enter the last two digits of the fiscal year.", vbOKOnly
Me.TXTSEQUENCE = Nz(DMax("[SEQUENCE]", "[Purchase Details]", "[CONSIGNEE]= '" & Me.[TXTFCODE] & "'"), 0) + 1
Me.Dirty = False
Me.TXTSEQUENCE = Nz(DMax("[SEQUENCE]", "[PURCHASE DETAILS]", "[CONSIGNEE] = '" & Me.TXTFCODE & "' AND [FYEAR] = '" & Me.TXTFYEAR & "'"), 0) + 1
Me.POID.Visible = True
Thanks so much for your help!! I is greatly appreciated as always. Carla :)
I'm a little confused about why you are generating TXTSEQUENCE twice. If the sequence is based on the combination of Consignee and Fiscal Year, then you shouldn't be generating the number just on Consignee.
But to prevent the possibility of 2 users generating the same sequence, create a multi-field unique index on the combination of the three fields.
Hope this helps,