ACC: ValidationRule Parses Function Name without Parentheses to String (97512)



The information in this article applies to:

  • Microsoft Access 1.0
  • Microsoft Access 1.1
  • Microsoft Access 2.0
  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97

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.

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.

Modification Type:MajorLast Reviewed:5/9/2003
Keywords:kbprb kbusage KB97512