Can you link IIf functions together?

D

dutty2001

Is there a way I can link several, like 3 or 4, IIf functions together?
I'm a little new to Access syntax, but I'm trying to put som
calculations in my report and I have more outcomes possible than jus
"statement, true, false." If anyone can give me some examples to wor
with, if this is possible, that would be great.

Thanks

Danie
 
J

John Vinson

Is there a way I can link several, like 3 or 4, IIf functions together?
I'm a little new to Access syntax, but I'm trying to put some
calculations in my report and I have more outcomes possible than just
"statement, true, false." If anyone can give me some examples to work
with, if this is possible, that would be great.

You can nest them: e.g.

IIF(Statement1, IIF(Statement2, TrueForBoth, TrueFor1),
IIF(Statement2, truefor2, falseforboth))

There is a limit on the total length of an expression, and it's not
hard to come up with a nested IIF that exceeds this limit. There is
also a limit on my brainpower to understand deeply nested IIF's that
hits rather sooner!

Or you may find the SWITCH function useful: it takes an arbitrary
number of arguments in pairs, and returns the second member of the
first pair for which the first member is true. E.g.

IIF(Statement1, Result1, Statement2, Result2, Statement3, Result3,
TRUE, DefaultResult)
 

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