Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input mask warning message 1

Status
Not open for further replies.

StuMunro

Programmer
Mar 2, 2001
29
0
0
GB
I have set up an input mask for a date field text box in my Access 97 based application.

99/99/00;0;_

If I start entering the date ie 25/ and tab out of the text box I get the following warning.

"The value you entered isn't appropriate for the input mask '99/99/00;0;_' specified for this field."

This message is not application user friendly as the extra ';0;_' in the input mask is meaning less to the user only useful to the programmer.

Is there a way of defining my own message ??

such as

"the date entered is incorrect use the format dd/mm/yy."

Stu
 
This is a data error and can be trapped in the form's On Error event in the Events Property window. Your particular error message's number is 2279. Thus you would use the following:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2279 Then
'The above traps your error
Response = 0
'The above keeps Access from displaying the usual message MsgBox "My message!"
'Your message
End If
End Sub

Hope this helps. ljprodev@yahoo.com
Professional Development
MS Access Applications
 
Thanks for your help, this is what I wanted to do.

Is the error code 2279 specific to date fields or just input masks in general?

If it is just a general code, I assume I will have to work out which is the active control to display a specific message?

Is there a list of the error codes somewhere as I am sure I could use this for other types of errors?

Thanks Stu

 
The only list of errors I could find were the run-time errors. Your error is not on this list. The run time errors can be found by invoking help and typing "Trappable Errors".
The way I identified your particular error number was to put a message box in the On Error event:

Msgbox DataErr

Since the error gives the format for your particular mask, I would assume this message is unique for your error. But you know what happens when you assume. ljprodev@yahoo.com
Professional Development
MS Access Applications
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top