ACC: BuildCriteria Method Returns Error for Certain Expressions (189128)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q189128 Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you use the BuildCriteria method, you may receive one of the following
errors:
Run-time error '2431': The expression you entered contains invalid
syntax. You may have entered a comma without a preceding value or
identifier.
Run-time error '2429': The In operator you entered requires
parentheses.
Run-time error '7956': The syntax of the subquery in this expression
is incorrect. Check the subquery's syntax and enclose the subquery in
parentheses.
CAUSE
You have used an SQL reserved word for the expression argument of the
BuildCriteria method. Specifically, you have used either the word "Select"
or "In" for your expression, as in the following example:
BuildCriteria("FieldName", dbText, "IN")
RESOLUTION
When you use the BuildCriteria method, enclose the expression in single
quotation marks, as in the following example:
BuildCriteria("FieldName", dbText, "'" & "IN" & "'")
STATUS
This behavior is by design.
REFERENCES
For more information about the BuildCriteria method, search the Help Index
for "BuildCriteria Method."
Also, please see the following articles in the Microsoft Knowledge Base:
170142 ACC: Issues When Using the BuildCriteria Method
178198 ACC97: Run-time error '2448' with BuildCriteria Method
Modification Type: | Major | Last Reviewed: | 10/22/2003 |
---|
Keywords: | kbprb KB189128 |
---|
|