SetFilter only works for one conditional, not two (1 Viewer)

cricketbird

Registered User.
Local time
Today, 16:40
Joined
Jun 17, 2013
Messages
108
I basically want a simple form that I can filter by three variables (SUPPLIER, FOOD, ANALYSIS). There are three comboboxes that let you pick from our short lists of suppliers, foods, and analyses, and a subform based on a query of those tables. This is a webform where I can't refer to the comboboxes in my query, so I am using localvars in a macro instead.

I have a search button that sets three local variables (my_SUPPID, my_ANALYSISID, my_FOODID) from the three combo boxes.

Code:
SetLocalVar
Name my_SUPPID
Expression = [cboSUPPS]

I then SetFilter with:
Code:
SetFilter
Where Condition = ([SUPPID]=[LocalVars]![my_SUPPID]) And ([FOODID]=[LocalVars]![my_FOODID])
Control Name subf_Analyses

and it works as expected.

However, if I add a third criteria for the remaining combo box:
Code:
 Where Condition = ([SUPPID]=[LocalVars]![my_SUPPID]) And ([FOODID]=[LocalVars]![my_FOODID]) And ([ANALYSISID]=[LocalVars]![my_ANALYSISID])
I get no records. The button works for any of the combinations of two criteria, but fails when I add a third.

I've debugged the results of my localvars and they are as expected.

Any help would be appreciated!
CB
 

isladogs

MVP / VIP
Local time
Today, 21:40
Joined
Jan 14, 2017
Messages
18,209
Just a guess but try an extra overall pair of brackets:

Code:
 Where Condition = [COLOR="red"]([/COLOR]([SUPPID]=[LocalVars]![my_SUPPID]) And ([FOODID]=[LocalVars]![my_FOODID]) And ([ANALYSISID]=[LocalVars]![my_ANALYSISID])[COLOR="Red"])[/COLOR]
 

cricketbird

Registered User.
Local time
Today, 16:40
Joined
Jun 17, 2013
Messages
108
The functional solution was indeed parentheses, but somehow not what you suggested.

((BOOL_A) AND (BOOL_B) AND (BOOL_C)) did not work.
However
((BOOL_A) AND (BOOL_B)) AND (BOOL_C) did. Scratching my head over this one still. At any rate, it works! Logically, these are the same, no? And, in fact, should be the same without any external parentheses (which is how I originally had it).

I feel there is some underlying problem - either a bug in my setup (most likely) or a bug in the system (possible). At any rate, it works.
 

Users who are viewing this thread

Top Bottom