Microsoft KB Archive/97512

= ACC: ValidationRule Parses Function Name without Parentheses to String =

Article ID: 97512

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q97512



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



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

NOTE: For this example to work correctly, after putting parentheses after =Date, you also need to change the Format property of the text box to General Date.



STATUS
This behavior is by design.



Steps to Reproduce Behavior

 * 1) Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).
 * 2) Create a new form not based on any table or query.
 * 3) Add a new, unbound text box to the form.
 * 4) On the View menu, click Properties.
 * 5) In the ValidationRule property of the text box, type the following line, and then press ENTER:

=Date

Note that Microsoft Access automatically changes the expression that you entered from =Date to =&quot;Date.&quot;
 * 1) On the View menu, click Form.
 * 2) Type a date in the text box.

When you type a date such as 09/08/95 in the text box and then press ENTER, you receive the message, &quot;The value you entered doesn't meet the validation rule defined for the field or control.&quot; However, the text box accepts the word &quot;date,&quot; which is the word changed by Microsoft Access in the ValidationRule property of the text box.

