Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB filter problem 1

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
Trying to set the following filter on an ADODB recordset gives an error message:
"Run-Time error '3001' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another"

Code:
mselectie="([mNaam] ='Smith, John' OR [mNaam] ='Brown, Joe') AND [gStatus_i] <18"
rsStud.Filter = mSelectie.Value

The following does work:
Code:
mselectie=" [mNaam] ='Smith, John'  OR  ([mNaam] ='Brown, Joe') AND [gStatus_i] <18)"
rsStud.Filter = mSelectie.Value

What is wrong with my first string?


 
Did you try this ?
Code:
mselectie="[mNaam] IN ('Smith, John','Brown, Joe') AND [gStatus_i] <18"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I have just tried your suggestion, but got the same error message. I can of course include the filter in the definition of my recordset, but I just don't see why my original filter doesn't work.
 
I've just reread the ADO help.
I'd try this:
Code:
mselectie="(mNaam='Smith, John' AND gStatus_i<18) OR (mNaam='Brown, Joe' AND gStatus_i<18)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you; this does indeed work. I hadn't realised that there are restrictions on the nature of an ADO filter (and see now that these are quite severe). As I want to allow a filter consisting of a random collection of parameter<operator>value clauses joined by random ANDs and ORs, I will have to build them into the SQL after all.
-Peter D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top