ACC: Error Using More Than 2000 Characters in WhereCondition of OpenReport (184948)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q184948 Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you run a procedure that contains the OpenReport method of the DoCmd
object, and you use the WhereCondition argument to pass a string that
contains more than 2000 characters, the report may not open. You may also
receive one of the following error messages:
- Run-time error '2465':
Microsoft Access can't find the field <field name> referred to
in your expression.
You may have misspelled the field name, or the field may have been
renamed or deleted.
- Run-time error '3464':
Data type mismatch in criteria expression.
- No current record.
- Out of memory.
Note that the number of characters in the WhereCondition argument that
causes this behavior may vary. For example, the problem may not occur until
the length of the WhereCondition argument exceeds 2048 characters.
RESOLUTION
You can use two methods to filter a report without limitation on the size
of the WHERE clause.
Method 1
Instead of using the WhereCondition argument, use the FilterName argument
of the OpenReport method to pass the name of a saved query. This method
allows you to filter a report without limitation on the size of the WHERE
clause.
Method 2
Use the Open event to set the RecordSource property of the report to the
SQL statement or to a saved query.
Note that the number of characters in a cell in the query grid is limited
to 1,024. If the SQL statement of the query results in more than 1,000
characters in a cell in the query grid, and if you use the FilterName
argument to pass the name of that query to the OpenReport method, you may
see unexpected behavior.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions
7.0 and 97.
REFERENCES
For more information about the OpenReport method, search the Help Index for
"OpenReport method," or ask the Microsoft Access 97 Office Assistant.
Modification Type: | Major | Last Reviewed: | 10/20/2003 |
---|
Keywords: | kbbug kberrmsg kbpending KB184948 |
---|
|