IIF check box Then use value from Combo box

elfranzen

Registered User.
Local time
Today, 00:05
Joined
Jul 26, 2007
Messages
93
I am trying to filter a query where if a check box is true then it will us this code. I haven't put in the false part yet because I can't get the true part to work. I have put the true part in the true and false part of the IIF statement and it still doesn't but if I take out the IIF statement it works just fine. what am I missing.

Also this is a number field.

IIf(([forms]![Report Form]![Check209]=True),<[forms]![Report Form]![Combo201])

Put this works just fine
<[forms]![Report Form]![Combo201]

Thanks
 
Try with -1 instead of True:
IIf(([forms]![Report Form]![Check209]=-1),<[forms]![Report Form]![Combo201])
 
The IIF will not work unless all the Arguments are filled in..

Also I am guessing you are trying to specify a Criteria on the Fly.. Something like..
Code:
SELECT someThing FROM someWhere
WHERE [COLOR=Red][B]someField[/B][/COLOR] [COLOR=Blue][B]IIF(someCondition, [COLOR=Red]<[/COLOR]10, [COLOR=Red]>[/COLOR]10)[/B][/COLOR]
The above will not work.. You cannot do that in a Built in Query, you might be better of Creating Dynamic Query for this sort..

The criteria should be predefined, like..
Code:
SELECT someThing FROM someWhere
WHERE [COLOR=Red][B]someField[/B][/COLOR] [COLOR=Blue][B] [COLOR=Red]< [/COLOR][/B][/COLOR][COLOR=Blue][B]IIF(someCondition, [COLOR=Red][/COLOR]10, 20)[/B][/COLOR]
 
OK I finished out the IIF statement and it still doesn't work.
IIf(([forms]![Report Form]![Check209]=-1),<[forms]![Report Form]![Combo201],<999999)
IIf(([forms]![Report Form]![Check209]=-1) Returns if check-box is checked or not in a form
<[forms]![Report Form]![Combo201] this pulls a number from a combo box either 30,60,90,180,270,365,999999

and if false returns the 999999
 
Okay again.. Is this what you are trying to do?
specify a Criteria on the Fly.. Something like..
Code:
SELECT someThing FROM someWhere
WHERE [COLOR=Red][B]someField[/B][/COLOR] [COLOR=Blue][B]IIF(someCondition, [COLOR=Red]<[/COLOR]10, [COLOR=Red]>[/COLOR]10)[/B][/COLOR]
The above will not work.. You cannot do that in a Built in Query, you might be better of Creating Dynamic Query for this sort..

The criteria should be predefined, like..
Code:
SELECT someThing FROM someWhere
WHERE [COLOR=Red][B]someField[/B][/COLOR] [COLOR=Blue][B] [COLOR=Red]< [/COLOR][/B][/COLOR][COLOR=Blue][B]IIF(someCondition, 10, 20)[/B][/COLOR]
 
Where ((dbo_BB_REVENUE.DaysOnLine)<IIf(([forms]![Report Form]![Check209]=-1),[forms]![Report Form]![Combo201],999999))

my Where state is very large but I took everything else out just to show you this part but I changed it around like this. and it still doesn't work. I guess I am not getting what your are tying to say. if you want I can copy my whole SQL statement.
 
Never mind you were right now it is working. thank you very much
 

Users who are viewing this thread

Back
Top Bottom