Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF in Query Criteria

Status
Not open for further replies.

GROG600

Programmer
Aug 15, 2002
4
0
0
AU
based upon selection from a form, I would like to vary the selection criteria in a query. for example

query field expr1,

crieria :

IIF([forms]![frm1]![option1]= true, &quot;<45&quot;, &quot;=45&quot;)

This doesn't work, any suggestions?

PS I know how to do it building an SQL statement in code, however, it is our corporate policy to use querys as often as possable, makes it easier for others to pick up and understand your work !

Thanks in advance.
 
select stuff
from yourtable
where [forms]![frm1]![option1] = true
and something < 45
union all
select stuff
from yourtable
where [forms]![frm1]![option1] = false
and something = 45

only one side of the union will return rows

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top