Default Error Message

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I have a table, tbDetails with a primary key field,
MemberNo not allowing duplicetes. When users with little
access experience enter a duplicate member number and they
receive a system message explaining what they have done.
My question, is there any way of cancelling this message
and setting up my own?

Regards
Nick
 
Sounds as if you're entering data directly into the table. Do not do that!
Always use a form for data entry.

Tables give you no ability to run macros or VBA code; no ability to
"intercept" errors or error messages.

Forms give you such abilities, and it's there that you can provide your own
message for duplicate entries.
 
Try using this in the OnError event of your data entry form:

Const conDuplicateKey = 3022
Dim strMsg As String

If DataErr = conDuplicateKey Then
Response = acDataErrContinue
strMsg = "Attempting to Add Course# and/or Title that already
exists. Change Course/Activity#."
MsgBox strMsg, vbExclamation, "Duplicate Record"
End If


-Ed
 

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

Back
Top