Returns one of two values depending on the result of a specified logical expression.


IIF(<expL>, <exp1>, <exp2>)


The logical expression to evaluate to determine whether to return <exp1> or <exp2>.


The expression to return if <expL> evaluates to true.


The expression to return if <expL> evaluates to false. The data type of <exp2> doesn't have to be the same as that of <exp 1>.


IIF(†) stands for "immediate IF" and is a shortcut to the IF...ELSE...ENDIF programming construct. Use IIF(†) as an expression or part of an expression where using IF would be cumbersome or not allowed. In particular, if youíre evaluating a condition to decide which value you want to assign to a variable or property, using IIF(†) involves less duplication (you donít have to type the target of the assignment twice).

If <exp1> and <exp2> are true and false, in either order, using IIF(†) is redundant because <expL> must evaluate to either true or false anyway.