How to Correctly Use the IIf Function to Filter a Microsoft Access Lookup List
Question details
The user needs to filter a Microsoft Access lookup list using a conditional expression but encounters an error due to a mistyped function name.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Reducing or filtering a lookup list based on a specific field value using a conditional expression in the row source or criteria.
- Observed behavior
- The system returns an error because the immediate-if function (IIf) was incorrectly typed as 'llf' (lowercase Ls) or 'Iff' due to small font sizes making the characters hard to distinguish.
Ensure you have Design View access to your Microsoft Access database and consider increasing your screen's font size temporarily to easily distinguish between capital 'I' and lowercase 'l'.
Correct the IIf Function Spelling and Syntax
Fix typographical errors and apply the correct syntax for the immediate-if (IIf) function to resolve the expression error.
The most common cause of this error is mistyping the function name. Because of certain font styles, a capital 'I' can look identical to a lowercase 'l'. The correct spelling is 'IIf' (Capital I, Capital I, lowercase f). There is no built-in 'llf' or 'Iff' function in Access.
Open your Microsoft Access database, right-click the form or query containing your lookup list, and select 'Design View'.
Find the criteria row or the Row Source property where you entered your conditional expression.
Change any incorrect spellings like 'llf' or 'Iff' to the correct spelling: 'IIf'.
Ensure your expression follows the standard immediate-if format: IIf(condition, value_if_true, value_if_false).
Save your changes and switch to Form View or Datasheet View to confirm that the lookup list now filters correctly without triggering an error.

Manage Data and Conditional Lists Easily with WPS Office
While Microsoft Access is a specialized database tool, many users find that managing filtered lists and conditional data is much easier in a spreadsheet. WPS Spreadsheet offers powerful data validation, IF formulas, and a familiar interface to handle your list-filtering tasks effortlessly.
- 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
- 2. Open WPS Spreadsheet: Launch WPS Spreadsheet and open your existing data files, or start a new workbook.
- 3. Apply Conditional Formulas: Use the standard =IF() formula or the Data Validation menu to create dynamic, filtered drop-down lists instantly.

Frequently Asked Questions
Why does Microsoft Access show an 'undefined function' error for IIf?
This usually happens due to a typographical error. Ensure you have typed 'IIf' (two capital letter 'I's followed by a lowercase 'f') rather than 'llf' (lowercase 'L's) or 'Iff'.
What is the correct syntax for the IIf function in Access?
The correct syntax is IIf(expr, truepart, falsepart). You must provide the condition to evaluate, the value to return if the condition is true, and the value to return if the condition is false.
Can I use IIf to filter a combo box Row Source?
Yes, you can use the IIf function within the WHERE clause of the SQL statement in your combo box's Row Source property to dynamically filter the listed items based on specific conditions.




