ACC: ValidationRule Parses Function Name w/o Parens to String

ID: Q97512


The information in this article applies to:


SYMPTOMS

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

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.


MORE INFORMATION

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 ="Date."


  6. On the View menu, click Form.


  7. 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, "The value you entered doesn't meet the validation rule defined for the field or control." However, the text box accepts the word "date," which is the word changed by Microsoft Access in the ValidationRule property of the text box.



REFERENCES

For more information about creating functions, search the Help Index for "functions," and then "creating," or ask the Microsoft Access 97 Office Assistant.

Additional query words: validation


Keywords          : kbusage ExrOthr 
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 20, 1999