No, you can nest IIF() statements inside either result of an if. For example
IIF(A < B, IIF(B < C, "C", "B"), IIF(A < C, "C", "A"))
Will tell you which of the three variables is larger. But nesting IIF
statements can get very complicated, so when I write on out, I generally try
to write it like:
IIF(A < B, _
IIF(B < C, _
"C", _
"B"), _
IIF(A < C, _
"C", _
"A") _
)
This helps me make sure I have all of the pieces where they ought to be, and
the parenthesis as well. Then, I get rid of the line break characters while
trying to keep it readable.
When I get to the point where the nesting is hard to read, I create a
function and pass it the values. That way, I can actually document what is
going on so that someone reading the code or query can actually determine
what I'm trying to accomplish.
--
HTH
Dale
Don''t forget to rate the post if it was helpful!
email address is invalid
Please reply to newsgroup only.