Can you link IIf functions together?

  • Thread starter Thread starter dutty2001
  • Start date Start date
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
 
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)
 
Back
Top