Help with IIF in a query

  • Thread starter Kurt Abele via AccessMonster.com
  • Start date
K

Kurt Abele via AccessMonster.com

Here is the issue, I have a form that has several list boxes that get their
data from a table that is created by running several queries. Now, I have
added a check box to the form and if it is selected I want to apply a
filter to the queries that make the table. Here is the statment:

IIf([Forms]![frmVisibility]![filteron]=-1,[forms]![frmVisibility]![bufilter]
, "EPG" or "PM" or "RSG" or "BI")

And I get an error saying the expression is too complex. The problem is
that if I use
IIf([Forms]![frmVisibility]![filteron]=-1,[forms]![frmVisibility]![bufilter]
, "") I get no data when the filter is turned off.

Any help is welcome! Thanks in advance.
 
K

Ken Snell [MVP]

You cannot use an IIf function this way (meaning to try to get multiple
"values" for comparison in a WHERE clause -- each value used for a
comparison in a query's WHERE clause must have the "field name = " fragment
in front of each value, or a completely different syntax must be used).

Post the SQL statement of the entire query that you're trying to run; it'll
be necessary to use the IIf function in a different context.
 
K

Kurt Abele via AccessMonster.com

OK thanks - I have gone on to trying something different.
 
Top