Microsoft KB Archive/235892

From BetaArchive Wiki
Knowledge Base


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

Article ID: 235892

Article Last Modified on 8/23/2001



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



This article was previously published under Q235892

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: error 800a0bb9

Keywords: kberrmsg kbdatabase kbprb kbmdacnosweep KB235892