customize error messages

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

Guest

How do I customize error messages for data input on forms (without code).
fields have validation, I would like to write my own error messages. (I know
how to use the validation rule/text property.)
thank you
 
Hi Deborah.

Since you are not talking about the validation rule/text, I presume you are
talking about the engine-level messages such as "The value is not
apprpriate...", or "Required...", or "... would be a duplicate..."

You need to use the Error event of the form to trap these errors.
Unfortunately this does mean you need to use code. If you use a macro you
will not know which error occurred, and so you would be limited to an
extremely generic msgbox that said basically, "Oops: that didn't work, but I
can't tell you why."
 
How do I customize error messages for data input on forms (without code).
fields have validation, I would like to write my own error messages. (I know
how to use the validation rule/text property.)
thank you

Without Code? You can't.
With Code... it's quite easy.

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."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
 
Back
Top