Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/104972

From BetaArchive Wiki

Article ID: 104972

Article Last Modified on 5/6/2003


  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition

This article was previously published under Q104972

Moderate: Requires basic macro, coding, and interoperability skills.


Microsoft Access evaluates expressions with logical operators differently than you expect. For example, if you enter zero in a field with the validation rule set to "=true and not true," you may receive the following error message:

The value you entered is prohibited by the validation rule set for this field.


Microsoft Access evaluates expressions in parts, and compares each part to the value in the field being validated. The expression "=true and not true" is evaluated as:

   Field=True AND Field<>True

This results in the error message if you enter zero in the field because the validation fails.


Use parentheses in the expression to change the way the expression is evaluated. The correct syntax for the example above is:

   =(True AND NOT True)

Microsoft Access will interpret this expression as:

   Field=(True AND NOT True)

Zero is an acceptable value for a field with the above validation rule.


Steps to Reproduce Behavior

  1. Open a new, blank form in Design view.
  2. Add a text box with the following validation rule to the form:

          Text box: Field1
             Validation rule: =True and not True
  3. View the form in Form view.
  4. Enter a zero in the text box, and then press ENTER. Note that you receive the error message mentioned earlier in this article.

Additional query words: boolean bitwise math

Keywords: kbprb kbusage KB104972