I need some help with DMax multi user.
I don't get a PO number and when I click on my subform I can't change the values because it says I need to add multi user.
Also code that Chris O and RainLover had references additional fields which I don't have. I only have the one field that needs updating.
I have PONumber textbox and tbl.Purchase with the field PO
Here's the code I used.
Private Sub PONumber_AfterUpdate()
If (conHandleErrors) Then On Error GoTo ErrorHandler
' If we have some data
If Len(Me!PONumber) Then
' Find the highest number and increase it by ONE.
Me!PONumber = Nz(DMax("[PONumber]", "tblPurchaseOrder", "[PO] = '" & Me!PONumber & "'"), 0) + 1
Else
MsgBox "A String is Required", vbInformation, "Missing Information"
Screen.PreviousControl.SetFocus
Me.Undo
End If
' Added 03/02/2011 by Rainlover.
Me.txtConcatenated = Me.txtmyLetter & Me.txtmyNumber
Me.Refresh
ExitProcedure:
Exit Sub
ErrorHandler:
DisplayError "PONumber_AfterUpdate", Me.Name
Resume ExitProcedure
End Sub
Private Sub Form_Error(ByRef intDataErr As Integer, ByRef intResponse As Integer)
' Designed by ChrisO.
' If in a multiuser environment it is quite possible for more that one
' machine to attempt to write the same value which will cause a Form Error.
' Handle the error and exit the Sub.
' Is it a duplicate index value error?
If intDataErr = 3022 Then
' Ignore the data error.
intResponse = acDataErrContinue
' Set the timer handler and interval.
Me.OnTimer = "=BumpTheNumber()"
Me.TimerInterval = 1
End If
End Sub
Thanks!
I don't get a PO number and when I click on my subform I can't change the values because it says I need to add multi user.
Also code that Chris O and RainLover had references additional fields which I don't have. I only have the one field that needs updating.
I have PONumber textbox and tbl.Purchase with the field PO
Here's the code I used.
Private Sub PONumber_AfterUpdate()
If (conHandleErrors) Then On Error GoTo ErrorHandler
' If we have some data
If Len(Me!PONumber) Then
' Find the highest number and increase it by ONE.
Me!PONumber = Nz(DMax("[PONumber]", "tblPurchaseOrder", "[PO] = '" & Me!PONumber & "'"), 0) + 1
Else
MsgBox "A String is Required", vbInformation, "Missing Information"
Screen.PreviousControl.SetFocus
Me.Undo
End If
' Added 03/02/2011 by Rainlover.
Me.txtConcatenated = Me.txtmyLetter & Me.txtmyNumber
Me.Refresh
ExitProcedure:
Exit Sub
ErrorHandler:
DisplayError "PONumber_AfterUpdate", Me.Name
Resume ExitProcedure
End Sub
Private Sub Form_Error(ByRef intDataErr As Integer, ByRef intResponse As Integer)
' Designed by ChrisO.
' If in a multiuser environment it is quite possible for more that one
' machine to attempt to write the same value which will cause a Form Error.
' Handle the error and exit the Sub.
' Is it a duplicate index value error?
If intDataErr = 3022 Then
' Ignore the data error.
intResponse = acDataErrContinue
' Set the timer handler and interval.
Me.OnTimer = "=BumpTheNumber()"
Me.TimerInterval = 1
End If
End Sub
Thanks!