B
Bob Richardson
I want to intercept the standard Access error message for a run time error
3022. The VBA help has this nice example, but it doesn't work for me.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const conDuplicateKey = 3022
Dim strMsg As String
If DataErr = conDuplicateKey Then
Response = acDataErrContinue
strMsg = "Each employee record must have a unique " _
& "employee ID number. Please recheck your data."
MsgBox strMsg
End If
End Sub
When I enter a duplicate record, the above message never appears, and I
still get the old Access message (about a duplicate key). I've put the above
in the On Error event of the form. What's going on?
3022. The VBA help has this nice example, but it doesn't work for me.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const conDuplicateKey = 3022
Dim strMsg As String
If DataErr = conDuplicateKey Then
Response = acDataErrContinue
strMsg = "Each employee record must have a unique " _
& "employee ID number. Please recheck your data."
MsgBox strMsg
End If
End Sub
When I enter a duplicate record, the above message never appears, and I
still get the old Access message (about a duplicate key). I've put the above
in the On Error event of the form. What's going on?