ACC: Validation Rules Evaluate Expressions in Unexpected WaysID: 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
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)
Field=(True AND NOT True)
Text box: Field1
Validation rule: =True and not True
Additional query words: boolean bitwise math
Keywords : kbusage GnlValid
Version : 1.0 1.1 2.0 7.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: March 27, 1999