R
rblivewire
I have a form that has a code that automatically generates the next
number from the highest number: (Default Value =DMax(" [#] ","Tool
Tracking List")+1) With this I want to customize it for a multi-user
environment. I tried this code to get automatically generate the next
number up on an error, but its not working. It just gives the duplicate
value error and an OK button, but doesn't change the number to the next
one up. Anything wrong with the code?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
Response = IncrementField(DataErr)
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error
End Sub
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me!ProductID = DMax("ProductID", "Product") + 1
IncrementField = acDataErrContinue
End If
End Function
number from the highest number: (Default Value =DMax(" [#] ","Tool
Tracking List")+1) With this I want to customize it for a multi-user
environment. I tried this code to get automatically generate the next
number up on an error, but its not working. It just gives the duplicate
value error and an OK button, but doesn't change the number to the next
one up. Anything wrong with the code?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
Response = IncrementField(DataErr)
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error
End Sub
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me!ProductID = DMax("ProductID", "Product") + 1
IncrementField = acDataErrContinue
End If
End Function