From: eRDe on
Hi All,
I tried to filter the record in my form but it seem it doesn't work as
expected.
I tried to create a concatenate filter and put all criteria in an array but
it seem, it just applying the last condition only.

here is the filter action code
============================

For each rs in array(rs1,rs2,rs3,rs4,rs5)
If rs = "" then
Else
MsgBox rs
DoCmd.ApplyFilter, rs
End If
Next rs

============================

I want to filter the record by rs1 (if its not null) next by rs2
and so on.
But what I get is, the previous filter is removed before the next
filter is applied.How to solve this??
Perhaps somebody out there would like to help.

Regards,

From: John W. Vinson on
On Sat, 5 Jun 2010 08:41:46 -0700, eRDe <eRDe(a)discussions.microsoft.com>
wrote:

>Hi All,
>I tried to filter the record in my form but it seem it doesn't work as
>expected.
>I tried to create a concatenate filter and put all criteria in an array but
>it seem, it just applying the last condition only.
>
>here is the filter action code
>============================
>
>For each rs in array(rs1,rs2,rs3,rs4,rs5)
> If rs = "" then
>Else
>MsgBox rs
>DoCmd.ApplyFilter, rs
>End If
>Next rs
>
>============================
>
>I want to filter the record by rs1 (if its not null) next by rs2
>and so on.
>But what I get is, the previous filter is removed before the next
>filter is applied.How to solve this??
>Perhaps somebody out there would like to help.
>
>Regards,

A Filter clause is a valid SQL WHERE clause, without the word WHERE. You'll
need to construct such a string, using AND or OR logic as appropriate; it can
include many terms, but it's just one filter, not many.

You don't indicate what rs1 and rs2 and so on contain, so it's not clear to me
how best to concatenate them; could you post an example? What field are you
filtering, and where do these criteria come from?
--

John W. Vinson [MVP]