Validation and System error messages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:
I have validation rules on my tables. I also have validation messages that are
displayed if the rules are violated. After my validation message is
displayed a system error message is also displayed. How can I prevent the
system error message from displaying after message?
Thanks,
J.
 
Hello:
I have validation rules on my tables. I also have validation messages that are
displayed if the rules are violated. After my validation message is
displayed a system error message is also displayed. How can I prevent the
system error message from displaying after message?
Thanks,
J.
 
Hmmm.....exactly how do I do that. Forgive my ignorance but I tried putting
Resume Next in the code but that didn't work.
Thanks,
J
 
Put this on the line before the point where the error would occur, such as
the BeforeUpdate of the control or form:

On Error Resume Next

Or you can put this as the first line in the procedure:

On Error GoTo ErrorHandler

and then this at the bottom of the procedure (just above End Sub):

Exit Sub
ErrorHandler:
MsgBox "Error #" & Err.Number & ": " & Err.Description

This will at least identify the error number for you. After that, you can
decide how you want to handle the specific error. You are likely to need to
undo the input if it is not valid (ControlName.Undo)
 
Got it. Thanks Brian.
J.

Brian said:
Put this on the line before the point where the error would occur, such as
the BeforeUpdate of the control or form:

On Error Resume Next

Or you can put this as the first line in the procedure:

On Error GoTo ErrorHandler

and then this at the bottom of the procedure (just above End Sub):

Exit Sub
ErrorHandler:
MsgBox "Error #" & Err.Number & ": " & Err.Description

This will at least identify the error number for you. After that, you can
decide how you want to handle the specific error. You are likely to need to
undo the input if it is not valid (ControlName.Undo)
 

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

Similar Threads


Back
Top