Returns one of two objects, depending on the evaluation of an expression.
Copy Code |
---|
object IIf ( |
Returns a if condition evaluates to true; otherwise, returns b.
The following example demonstrates how you can use IIf to find the smaller of two numbers:
Copy Code |
---|
IIf(5 < 3, 5, 3) |
Although the result of the above calculation is obvious, this may not always be the case. Here is the same example applied to fields from a database:
Copy Code |
---|
IIf(Field1 < Field2, Field1, Field2) |