Microsoft KB Archive/209603

= ACC2000: ValidationRule Property Parses Function Names Without Parentheses as Strings =

Article ID: 209603

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209603



Novice: Requires knowledge of the user interface on single-user computers.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you type an expression in the ValidationRule property of a text box, and the expression contains a function name that has no parentheses or parameters, Microsoft Access evaluates the expression as a string instead of a function.



RESOLUTION
Put parentheses or parameters after all function names so that they can be correctly evaluated as functions instead of text strings. For example, use

=Date

instead of:

=Date



Steps to Reproduce Behavior
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Start Microsoft Access and open the sample database Northwind.mdb. In the Database window, under Objects, click Form, click New, and then click OK to create a new form not based on any table or query. If the Toolbox is not visible, on the View menu, click Toolbox. In the Toolbox, click the Text Box button, and then click in the center of the form's Detail section. If the property sheet is not visible, on the View menu, click Properties. On the form's property sheet, click the Data tab.</li> Click the Validation Rule box, type >=Date, and then press ENTER.

Notice that Microsoft Access automatically changes the expression that you entered from >=Date to >="Date".</li> On the View menu, click Form.</li> Type the current date in the text box.

When you type a date such as 9 Jun 20 in the text box and press ENTER, you see the following error message:

The value you entered doesn't meet the validation rule defined for the field or control.

However, notice that the text box does accept the word "date," which is the word produced by Microsoft Access in the Validation Rule property of the text box.</li></ol>

<div class="references_section">