filtering forms for more than 1 item (1 Viewer)

oaishm

Registered User.
Local time
Today, 02:06
Joined
Oct 4, 2009
Messages
10
I tried to do it with:

Me![R heavy].Form.Filter = "[r] = " & Combo0 & ", [p] = " & Combo2 & ", flex=1"

but the error said there were commas where there shouldn't be.

does anyone know the right syntax?
 
Local time
Today, 04:06
Joined
Mar 4, 2008
Messages
3,856
I tried to do it with:

Me![R heavy].Form.Filter = "[r] = " & Combo0 & ", [p] = " & Combo2 & ", flex=1"

but the error said there were commas where there shouldn't be.

does anyone know the right syntax?

The error was correct. You can't do that.

Maybe you're looking for something like this:
Code:
Me![R heavy].Form.Filter = "[r] = " & [B]Me.[/B]Combo0 & " [B]AND [/B][p] = " & [B]Me.[/B]Combo2 & " [B]AND [/B]flex=1"

The question then comes up, what if the user didn't select anything from one or the other combo-boxes? You'll need to conditionally code for that.
 

oaishm

Registered User.
Local time
Today, 02:06
Joined
Oct 4, 2009
Messages
10
Yes, that's exactly the solution. In the filter field, access uses commas, but in vba you have to use "and".

Classic.

Thanks for your help, I can't imagine how you trial and errored your way through this.
 

Users who are viewing this thread

Top Bottom