MSQuery: Error Using Date in Criteria Expression in QueryLast reviewed: September 12, 1996Article ID: Q107196 |
The information in this article applies to:
SYMPTOMSIn Microsoft Query, when you use a date in a criteria expression, the date may not be correctly interpreted and you may receive the following error message
Error in predicate: <criteria field><criteria operator><criteria value> Incompatible types in predicate.where <criteria field> is an expression containing a date field, <criteria operator> is the condition that must be true for the expression, and <criteria value> is the comparison value for the expression.
WORKAROUNDTo avoid this error, use number signs (#) around dates in the criteria value field when you use them as the comparison value for a criteria expression. Microsoft Query does not interpret the date value correctly when the criteria field contains a date field in an expression.
MORE INFORMATIONA criteria value such as "1993-10-31" could be interpreted as either a date or an arithmetic expression. Microsoft Query only interprets an ambiguous expression to be a date when the criteria field type is a date. However, when the criteria field itself is an expression, "Date+3" for example, the date value is not correctly interpreted, and an error is generated.
Steps to Reproduce Behavior
Error in predicate: Date+3=<criteria value> Incompatible types in predicate.where <criteria value> is the value selected from the Values list in step 7.
REFERENCES"Microsoft Query User's Guide," version 5.0, pages 69-70 For more information about Criteria Expressions (Cue Cards) or Expressions Overview, choose the Search button in Help and type:
dates |
KBCategory: kbusage kbprb kbtool
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |