Help and Support

Article ID: 235892 - Last Review: August 23, 2001 - Revision: 1.0

PRB: 800a0bb9 Error Message When Applying a Filter to an ADO Recordset

This article was previously published under Q235892
Expand all | Collapse all

SYMPTOMS

When setting the Filter property of an ADO recordset, the following error is returned:
ADODB.Recordset error '800a0bb9'

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

CAUSE

This error can occur if the filter syntax is incorrect. This commonly occurs when using AND and OR operators and grouping clauses with parentheses. Though there is no precedence for AND and OR, the ADO Filter property does not allow you to group OR clauses within parentheses and AND clauses without parentheses.

For example, the following value for a filter returns the error:
(EmployeeID = 2 OR  LastName = 'Fuller') AND FirstName = 'Andrew'
				

RESOLUTION

To resolve the problem, rewrite your filter statement to not combine OR clauses grouped within parentheses as parts of a larger AND clause.

The following three variations do not return the error:
(EmployeeID = 2 AND LastName = 'Fuller') OR  FirstName = 'Andrew'
(EmployeeID = 2 OR  LastName = 'Fuller') OR  FirstName = 'Andrew'
(EmployeeID = 2 AND LastName = 'Fuller') AND FirstName = 'Andrew'
				
Note that the rules of logic result in very different results depending on where you place your AND and OR clauses. Be sure that your two filter statements are logically equivalent.

For example, the following filter syntax that returns the error:
(EmployeeID = 2 OR  LastName = 'Fuller') AND FirstName = 'Andrew'
				
is logically equivalent to the following filter syntax that does not cause the error to occur:
(EmployeeID = 2 AND FirstName = 'Andrew') OR (LastName = 'Fuller' AND FirstName = 'Andrew')
				

STATUS

This behavior is by design.

APPLIES TO
  • Microsoft ActiveX Data Objects 1.0
  • Microsoft ActiveX Data Objects 1.5
  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.01
  • Microsoft ActiveX Data Objects 2.1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
Keywords: 
kbdatabase kberrmsg kbmdacnosweep kbprb KB235892
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Article Translations