This run-time error 3101 is caused by the entry of an ID into a textbox which is not inside the "One" side of the table. As I have form.refresh in the afterupdate event of this textbox, immediately it pops out this error and prompts me to end or debug.
How do i make it prompt a msgbox instead of going into VB?
I tried inputting an if statement on error 3101 in the On_error event of the form below as shown
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' To prevent multiple user opening new TRF getting same number PART1
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
' To prevent multiple user opening new TRF getting same number PART2
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me![Job No] = DMax("[Job No]", "[QT Job Record]") + 1
IncrementField = acDataErrContinue
End If
If DataErr = 3101 Then
MsgBox ("No Such TRF Number! Please double check")
End If
End Function
This only half worked. It comes out only after getting going into the VB debug screen and only about quitting the VB screen then the msgbox will show.
Please advise.
How do i make it prompt a msgbox instead of going into VB?
I tried inputting an if statement on error 3101 in the On_error event of the form below as shown
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' To prevent multiple user opening new TRF getting same number PART1
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
' To prevent multiple user opening new TRF getting same number PART2
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me![Job No] = DMax("[Job No]", "[QT Job Record]") + 1
IncrementField = acDataErrContinue
End If
If DataErr = 3101 Then
MsgBox ("No Such TRF Number! Please double check")
End If
End Function
This only half worked. It comes out only after getting going into the VB debug screen and only about quitting the VB screen then the msgbox will show.
Please advise.