Syntax iif (condition, value_if_true, value_if_false) Key condition The expression to test. For multiple conditions use AND / OR value_if_true The value returned if condition evaluates to TRUE. value_if_false The value returned if condition evaluates to FALSE.
The iif() function may be used in VBA or in an SQL query. The value returned can be a text string, a number or a True/False literal value.
An Excel AND() function can be converted to Access like this:
iif(expression1 AND expression2, True)
Dim strLocal as String
Dim strDemo as String
strLocal = iif ([State] = "TX", "Local", "National")
strDemo = iif ([State] = "TX" OR [State] = "OK" , "Free Delivery ", "")
strDemo = iif ([State] = "TX" AND [Price] > 20 , "Free", "Delivery $8 surcharge")
“The test of a good teacher is not how many questions he can ask his pupils that they will answer readily, but how many questions he inspires them to ask him which he finds it hard to answer” ~ Alice Wellington Rollins
If Then Else - If-Then-Else
Case - If Then Else
Nz - Detect a NULL value