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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation text message not displaying (combo box)

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
Using Access 2000

Have a combo box on form. Underlying data is table of numeric data.

"Limit to list" set to: NO (want the user to be able to key a value not in the list).

"validation rule" set as: >=0 And <=100

"validation text" set as: "You must select or enter a numeric value in this field."

The validation rule works fine, if data other than a number betwee 0 and 100, access displays an error message.

the problem is, access does not display my validation text message, rather, it displays a generic, nonsensical (to a user) message about "type mismatch" etc.

When I read the "help" info for Validation / rule / text, it says that if the validation text is present, it will display in lieu of the generic access message. it does not do this.

has anyone had this problem and found a solution ?

thanks
Paul
 
The data type setting for the field will over ride the numeric check.

Before the system can determine if the number is between X and Y, it has to determine that the entry is numeric.

Rather than using the properties of the field on the form, you have more control at the coding level. (But the entry still has to comply with the data type of the field -- if variant or unbound or text, the system is more forgiving than defining the field as a date or numeric -- but using the field on the form to only accept specific data types is perfectly valid.)

A more important issue is having null values.

Richard
 
check out what error number is created when it comes up as type mismatch, then check on error code of your combo box. Add, iff err.number = ? then msgbox "This should be a numberic field.

this should then recognise the error code of the type mismatch, and use your wording as opposed to the system generated one.

ie

Select Case Err
if err.number = 2032 then msgbox "testing"
Case Else
strerrmsg = strerrmsg & "Error #: " & Format$(Err.Number) & vbCrLf & vbCrLf
strerrmsg = strerrmsg & "Error Description: " & Err.Description & vbCrLf
MsgBox strerrmsg, vbInformation, "cmd_completion_Click"
Resume Exit_cmd_completion_Click
End Select

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top