Custom error message

J

John

There is a SQL error message that comes up saying that there is a duplicate
record for the index that I created and that the record cannot be saved. Is
there a way to have a custom error message that actually makes sensecome up
instead of that one.

Thanks in advance
 
A

Allen Browne

Use the Error event of the form.
Trap DataErr 3022.
Set up your own MsgBox.
Set Response = acDataErrContinue
 
J

John

Allen-

I am trying to trap the error message by saying:
"If Err.Message = "error # of the message"" but the error number that is
coming up is 0 which doesn't make sense to me. Also I am not sure how to not
get the real message not to come up. I am not sure what "Set Response =
acDataErrContinue" does but it was coming up with a syntax error using it.

Thanks in advance,
John
 
Top