Re: Filter Recordset

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 07/13/04


Date: Tue, 13 Jul 2004 13:43:25 -0400

Julio wrote:
> Hi,
> I am trying to filter a recordset using a condition like this:
> (fld1 LIKE '*epo*' Or fld2 LIKE '*epo*' Or fld3 LIKE '*epo*' Or fld4
> LIKE '*epo*' Or fld5 LIKE '*epo*' Or fld6 LIKE '*epo*') And (fld7 =
> 28)
>
> This is the error that i receive:
> ADODB.Recordset error '800a0bb9'
> Arguments are of the wrong type, are out of acceptable range, or are
> in conflict with one another.
>
> If i execute the part with ORs everything is ok as if i execute the
> part of the condition with AND.
>
> Any idea
> Thanks in advance
> Julio

>From online help:

a.. There is no precedence between AND and OR. Clauses can be grouped within
parentheses. However, you cannot group clauses joined by an OR and then join
the group to another clause with an AND, like this:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'a..
Instead, you would construct this filter as
(LastName = 'Smith' AND FirstName = 'John') OR (LastName = 'Jones' AND
FirstName = 'John')HTH,
Bob Barrows

-- 
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Relevant Pages

  • Re: ADODB & Recordset.Filter -> Problem mit Verkettung
    ... angeschaut und da steht: ... This error can occur if the filter syntax is incorrect. ... and grouping clauses with parentheses. ...
    (microsoft.public.de.vb.datenbank)
  • RE: Use Filter To Print This Record Only
    ... The quotes in Where clauses always mess me up, ... "Bonnie" wrote: ... >> Filter Property. ...
    (microsoft.public.access.formscoding)
  • Re: Write to and store data in a listbox
    ... clause into a string and apply it to the form's filter. ... most-used WHERE clauses. ... Build a table with 3 or more columns: UserID, Description, ... Populate the listbox from the table. ...
    (comp.databases.ms-access)
  • Re: Filter error... but why?
    ... you cannot group clauses joined by an OR and then join ... you would construct this filter as ... > Exception - Arguments are of the wrong type, are out os acceptable range, ... > Regards, Mike Niemann ...
    (borland.public.delphi.database.ado)