PDA

View Full Version : Solved: Conditional Criteria in query



AJS
11-25-2004, 06:04 PM
Hi,

I have been trying to set up a query such that it looks up the selection in an unbound combo box on a form otherwise based on the query. It is supposed to work like this: if a certain value is selected in the combo box, then one field is filtered, if another value is selected then a different field would be filtered in a different way etc.

To do this, I have set up a series of iif expressions in the query such as:

IIf([Forms]![Table1]![Combo10]="A","Name1","")

under a text field, and

IIf([Forms]![Table1]![Combo10]="B",Yes,"")

under a Yes/No field etc.

Basically, I'm trying to set it up such that if the specified value is not present, then the field is unfiltered. When I try to reopen the form, I get an error message saying that "the expession is typed incorrectly, or it is too complex to be evaluated". Have I got the syntax right, or should I be using a different approach?

AJS
11-25-2004, 06:59 PM
Got it working, via:

IIf([Forms]![Table1]![Combo1]="A","Name1",[Name])

etc...