IIF Query

A

Annie

Hi
Is it possible to have a nested IIF function in an Access query. I can
handle the normal IIF([Stock]<10,"reorder now"," ") but was looking to
include more options.

Many thanks
 
B

BruceM

Yes, you can, but without knowing more details it is impossible to know
whether it is the best course, or how to address any specific questions that
have arisen. How many options are we talking about here? By the way, I
would think you want an empty string ("") rather than a literal space (" ").
 
D

David F Cox

In general terms you can use a function almost anywhere you can use a value.

so if you have IIF ( X > 10 ......

you could replace X by IIF( [xyswitch] = TRUE, [myscore], [yourscore])
and replace 10 by IIF([EasySwitch] = TRUE, 10, 20)

There are limits to how many functions can be nested, but they are usually
beyond the point where the formula is too complex for humans too.
 
A

Annie

It was just a question one of my students had regarding the similarities
between the if function in excel and iif in Access - say 3 or 4 arguments???

Many thanks

--
Kind regards

Ann Shaw


BruceM said:
Yes, you can, but without knowing more details it is impossible to know
whether it is the best course, or how to address any specific questions that
have arisen. How many options are we talking about here? By the way, I
would think you want an empty string ("") rather than a literal space (" ").

Annie said:
Hi
Is it possible to have a nested IIF function in an Access query. I can
handle the normal IIF([Stock]<10,"reorder now"," ") but was looking to
include more options.

Many thanks
 
B

BruceM

The syntax is quite similar; offhand I can't think of a difference, but I'm
not 100% certain of that. Last I knew the If function in Excel is limited
to seven levels. I think IIf has the same limitation, but I cannot find a
definitive answer to that (although I can't say I looked very hard). Beyond
about 3 or 4 levels I would think about using Select Case in VBA, or maybe
the Switch function.

Annie said:
It was just a question one of my students had regarding the similarities
between the if function in excel and iif in Access - say 3 or 4
arguments???

Many thanks

--
Kind regards

Ann Shaw


BruceM said:
Yes, you can, but without knowing more details it is impossible to know
whether it is the best course, or how to address any specific questions
that
have arisen. How many options are we talking about here? By the way, I
would think you want an empty string ("") rather than a literal space ("
").

Annie said:
Hi
Is it possible to have a nested IIF function in an Access query. I can
handle the normal IIF([Stock]<10,"reorder now"," ") but was looking to
include more options.

Many thanks
 

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