Turning off error messages?

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

Can I turn off the Access error messages and replace them with my own
message box message? I thought I'd seen something about this in this group
but I've searched and found nothing.
Thanks
Tony
 
Can I turn off the Access error messages and replace them with my own
message box message? I thought I'd seen something about this in this group
but I've searched and found nothing.
Thanks
Tony

Probably but you haven't indicated what error message or where.
Since this is posted in the FormsCoding newsgroup, I'll assume a form
level error message.

Here's how you can find the correct error and show your own message
for any of the form level errors.

First code the Form's Error event:

MsgBox "Error#: " & DataErr ' Display the error number
Response = acDataErrDisplay ' Display Default message

Then open the form and intentionally make that error.

The message box will display the error number and the default error
message.

Next, go back to the error event and change that code to:

If DataErr = XXXX Then
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please enter data in all required fields." ' Do display your
own message
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
 
Fred I'm getting a message that says Index or primary key cannot contain a
Null value
Putting in your first code gives me error 3058 and the Access Message
Tried second part of code but still got the Access message?
What am I doing wrong?
Thanks
Tony
 
Sorry Fred it's sorted works just fine thanks
Tony
Tony Williams said:
Fred I'm getting a message that says Index or primary key cannot contain a
Null value
Putting in your first code gives me error 3058 and the Access Message
Tried second part of code but still got the Access message?
What am I doing wrong?
Thanks
Tony
 
Back
Top