ADODB Recordset Filter problem
dim rst as ADODB.Recordset
set rst = new ADODB.Recordset
rst.open select field1,field2 from table
..
..
rst.Filter = "(field1 = 100)" it works!
rst.Filter = "(field2 = 2 or field2 = 3)" it also works!
but it doesnt work:
rst.Filter = "(field1 = 100) and (field2 = 2 or field2 = 3)"
//Error: wrong type or conflict between parameters..
WHY?? plz help!!
Re: ADODB Recordset Filter problem
Luckily I ran into this once before.
And fortunately I remember that I did find a way aorund it.
And even more fortunately I was able to find it on MSDN
The filter needs to be re-written.... it's a simple thing to do though:
VB Code:
rst.Filter = "(field1 = 100 and field2=2) or (field1 = 100 or field2 = 3)"
Seems like a stupid thing to have to do, but it's the way ADO was written.
Tg
Re: ADODB Recordset Filter problem
I need a function which do this convertation for me automatically. I assembly the condition string in runtime...
Re: ADODB Recordset Filter problem
It would probably be easier to change the way you build the string than write a function to convert it.