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

Last reviewed: May 28, 1997
Article ID: Q97512
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

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

When you type an expression containing a function name that has no parentheses or parameters in the ValidationRule property of a text box, the expression is evaluated 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 : ExrOthr kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.