Doing multiple filters to a recordset

c0zee
c0zee used Ask the Experts™
on
i have a recordset (ADO) and i still have several criterias to filter this and i am trying to do this  using the filter function (rs.filter = [criteria])
im using VB6 here by the way

i DO NOT want to do it this way(style 1):
rs.filter = [criteria1] AND [criteria2] AND...[criteriaN]

i WANT it to do it this way (style 2):
rs.filter = [criteria1]
...
rs.filter = [criteria2]
...
rs.filter = [criteriaN]
but unfortunately it gives me wrong set of data.

can somebody help me on how to make some workaround so that style 2 will give me the same recordset as style 1.
thanks in advance for the help!

 

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
You would need to concatenate your filters like this:

rs.filter = rs.filter & " AND " & [criteria2]

Author

Commented:
any other suggestions?
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
can I ask you why you don't like mine?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
hey emoreau, first of all thanks for your suggestion (although i havent tried it yet, im on vacation), 2nd i didnt say that i dont like your suggestion.
im just asking for some other suggestions maybe there are people out there that have other workarounds or ideas about my question.
peace!  :)
Senior .Net Consultant
Top Expert 2016
Commented:
please maintain

Questions Asked 1
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
question answered by emoreau
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

apptsolu
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial