Replacing "input mask" error

R

richardb

I have a date field on a form with a mask so that the date is entered in a
standard format. When the mask is violated, Access presents its standard
message: "The value you entered isn't appropriate for the input mask
'00/00/0000;0;_' specified for this field".

I want to suppress this message and replace it with a more user friendly
message, but have not been able to figure out how. Can anyone help please.

rb
 
F

fredg

I have a date field on a form with a mask so that the date is entered in a
standard format. When the mask is violated, Access presents its standard
message: "The value you entered isn't appropriate for the input mask
'00/00/0000;0;_' specified for this field".

I want to suppress this message and replace it with a more user friendly
message, but have not been able to figure out how. Can anyone help please.

rb

The error can be trapped in the Form's Error event.

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.
 
R

richardb

Perfect...thank you.

fredg said:
The error can be trapped in the Form's Error event.

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.
 

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

Top