T
tina
try creating a procedure in the form's OnError event to
trap the error code that produces the default error
message, then insert your own message instead, as
Private Sub Form_Error(DataErr As Integer, Response As
Integer)
'this is a quick way to display the error number so you
can trap it.
MsgBox DataErr
'once you identify the error number, you can delete or
comment out the Msgbox line of code above.
If DataErr = 3022 Then
MsgBox "Duplicate serial number - please enter
unique serial number."
Response = acDataErrContinue
Me!SerialNumberField = Null
'the Null line of code is just a convenience, so the user
can just start typing again immediately after closing the
message box.
End If
End Sub
recommend you read up on the form's OnError event in Help,
so you'll understand the Response options available to you.
hth
trap the error code that produces the default error
message, then insert your own message instead, as
Private Sub Form_Error(DataErr As Integer, Response As
Integer)
'this is a quick way to display the error number so you
can trap it.
MsgBox DataErr
'once you identify the error number, you can delete or
comment out the Msgbox line of code above.
If DataErr = 3022 Then
MsgBox "Duplicate serial number - please enter
unique serial number."
Response = acDataErrContinue
Me!SerialNumberField = Null
'the Null line of code is just a convenience, so the user
can just start typing again immediately after closing the
message box.
End If
End Sub
recommend you read up on the form's OnError event in Help,
so you'll understand the Response options available to you.
hth