Getting rid of generic warning

R

Randy

Access 2000. I have a table with 3 fields indexed to prevent duplicates.
How do I get rid of the generic warning stating "Duplicate keys" etc. and
replace it with a custom warning of my choosing?..Thanks
 
W

Wayne Morgan

This error can be trapped in the form's Error event. The error number is
3022.

Example:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const DUPLICATE_INDEX = 3022
If DataErr = DUPLICATE_INDEX Then
MsgBox "This exercise is/was previously issued to this trainee. Please"
& vbCrLf & _
"select another exercise from this category or press the close form
button."
Response = acDataErrContinue
End If
End Sub
 
R

Randy

Thanks Wayne.
Wayne Morgan said:
This error can be trapped in the form's Error event. The error number is
3022.

Example:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const DUPLICATE_INDEX = 3022
If DataErr = DUPLICATE_INDEX Then
MsgBox "This exercise is/was previously issued to this trainee.
Please" & vbCrLf & _
"select another exercise from this category or press the close form
button."
Response = acDataErrContinue
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top