Iif statement with OR in true,false

djphatic

Registered User.
Local time
Today, 17:06
Joined
Dec 18, 2009
Messages
26
Hello

I want to use an Iif statement in my query so that If a contractor has a certain value (True/False) then different records are filtered out.

I have standardtypes c, h, i and b. I always want to omit "b" (<>b) but depending on the true/false value I want to show/hide "i"

I have tried the following:

Iif ([tblServices]![Incentive]=True, "h" OR "c" OR "i", "h" OR "c")

It does not like this and says it has been inputted correctly or is too complex to evaluate.

Any suggestions on how I can do this?
 
If using SQL,
SELECT tblServices.IDNo, tblServices.OtherField, tblServices.Incentive, tblServices.Standardtypes
FROM tblServices
WHERE (((tblServices.Incentive)=True) AND ((tblServices.Standardtypes)="h" Or (tblServices.Standardtypes)="c" Or (tblServices.Standardtypes)="i")) OR (((tblServices.Incentive)=False) AND ((tblServices.Standardtypes)="h" Or (tblServices.Standardtypes)="c"));

If using Design View,
Criteria Row: (for Incentive) True (for Standardtypes) h or c or i
Or Row: (for Incentive) False (for Standardtypes) h or c

I threw in IDNo and OtherField for testing only.
 
If using Design View,
Criteria Row: (for Incentive) True (for Standardtypes) i
Or Row: h or c
 

Users who are viewing this thread

Back
Top Bottom