ACC2000: Run-time error '2448' with BuildCriteria Method (208970)
The information in this article applies to:
This article was previously published under Q208970 Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you use the BuildCriteria method to programmatically set the Filter property on a form and the Field argument of the BuildCriteria method references a field name that contains a space, you may receive the following error message:
Run-time error '2448':
You can't assign a value to this object.
CAUSE
The BuildCriteria method is used to generate a parsed criteria string as it would appear in the Query by Example (QBE) grid or in Filter By Form mode. Unlike the QBE grid or Filter By Form, however, the BuildCriteria method does not automatically enclose the field name within brackets.
RESOLUTION
To resolve this behavior, enclose the Field argument of the BuildCriteria method within brackets. For example, using the example in step 2 of the "Creating the Module" section of the "Steps to Reproduce Behavior" section later in this article, change the following expression from:
strFilter = BuildCriteria("Product Name", adBSTR, strInput)
to:
strFilter = BuildCriteria("[Product Name]", adBSTR, strInput)
REFERENCES
For more information about using the BuildCriteria method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type BuildCriteria method in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Modification Type: | Major | Last Reviewed: | 12/3/2002 |
---|
Keywords: | kberrmsg kbprb KB208970 |
---|
|