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

ID: Q235892


The information in this article applies to:
  • ActiveX Data Objects (ADO), versions 1.0, 1.5, 2.0, 2.01, 2.1, 2.1 SP1, 2.1 SP2


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.

Additional query words:

Keywords : kberrmsg kbADO kbADO150 kbADO200 kbADO201 kbADO210 kbGrpASP kbDSupport kbADO210sp2
Version : WINDOWS:1.0,1.5,2.0,2.01,2.1,2.1 SP1,2.1 SP2
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: August 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.