problem with criteria

G

Guest

I want to use an iif statement in the criteria for a query, but when "false"
I would like it to display all records.
Something like this is what makes sense to me.

iif(x>y,x,like *)

where it would filter to the value x when true, but would return all records
when false.

This does not work for me, at least with the number fields I'm trying to
work with. Nor does "x or y or z" despite that exact text working outside of
an iif statement. Is there a way to do this?

Thanks Nathan
 
W

Wolfgang Kais

Hello Nathan.
I want to use an iif statement in the criteria for a query, but when
"false" I would like it to display all records.
Something like this is what makes sense to me.

iif(x>y,x,like *)

where it would filter to the value x when true, but would return all
records when false.

This does not work for me, at least with the number fields I'm
trying to work with. Nor does "x or y or z" despite that exact text
working outside of an iif statement. Is there a way to do this?

Sure. Your criteria can be translated to a logical expression without
the iif function (let's say your column is named c): c = x or x <= y.
Maybe this helps in building the criteria.

When "x or y or z" is displayed as criterion for the column c in query
design view, it means "c = x or c=y or c=z". When used elsewhere, for
example as an argument of the iif function, "x or y or z" evaluates to
true if at least one of x, y and z is true, regardless of column c.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top