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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Filters on the same recordset

Status
Not open for further replies.

jamjam007

Programmer
Jun 24, 2005
2
0
0
US
Hello All!

I have this rst3. I have filters and want to apply them 1 by 1.

rst3.filter = filterstr1
if rst3.recordcount = 1 then exit
rst3.recordcount= filterstr2
if rst3.recordcount =1 then exit

suppose there are 4 records after the filterstr1 is applied. The program doesnot apply the next filter(filterstr2) on the filtered 4 records but it applies on the original record itself. how can I achieve this.

Thanks in advance
 
Dynamically set the SQL code.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi, jamjam007,

The first thing that pops to mind is to successively concatenate the filter conditions into a single filter string, and keep applying the filter string (maybe in a loop) until you only have one record. The general idea:

filter string = condition1
apply filter to recordset
if only 1 record, exit
if more than 1, rebuild filter string such that filter string = condition1 & condition2
reapply filter string
if 1 record, exit
if more than 1, rebuild filter string
string = condition1 & condition2 & condition3
etc.

HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top