O oaishm Registered User. Local time Today, 01:50 Joined Oct 4, 2009 Messages 10 Nov 12, 2009 #1 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?
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?
G georgedwilkinson AWF VIP Local time Today, 03:50 Joined Mar 4, 2008 Messages 3,856 Nov 12, 2009 #2 oaishm said: 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? Click to expand... 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 said: 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? Click to expand... 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.
O oaishm Registered User. Local time Today, 01:50 Joined Oct 4, 2009 Messages 10 Nov 12, 2009 #3 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.
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.