msg box for wrong data

G

ghost

Greeting,

Is there any code for display msg box in case of wrong input instead of
access warning? For example, if user input letters in field of date and time
property. Of course access gives warning msg, but as you know most of user do
not know what is wrong. I need a msg box tells user that user should input
date not letter on number.
Any help please?
 
F

fredg

Greeting,

Is there any code for display msg box in case of wrong input instead of
access warning? For example, if user input letters in field of date and time
property. Of course access gives warning msg, but as you know most of user do
not know what is wrong. I need a msg box tells user that user should input
date not letter on number.
Any help please?

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 the correct data in all required fields."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.
 
Top