How to Fix IIf Function Errors in Microsoft Access
Question details
The user is encountering syntax and separator errors when attempting to use the IIf function in Microsoft Access.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Entering a logical expression using the IIf function in a query, control source, or Expression Builder.
- Observed behavior
- Access throws operand, operator, comma, or quotation-mark errors even for seemingly valid expressions like IIf((1+1=2),'yes','no').
Verify the exact context where you are entering the expression (e.g., Expression Builder, query design, or form control) and ensure your Microsoft Office is updated.
Verify and Adjust Windows Regional List Separators
Access relies on your Windows regional settings to determine whether to use commas or semicolons to separate arguments in functions.
Often, a seemingly perfect formula will throw errors because the system expects a different list separator based on your geographic region.
Open the Windows Control Panel, navigate to 'Clock and Region', and then click on 'Region'.
On the Formats tab of the Region dialog box, click the 'Additional settings' button at the bottom.
Locate the 'List separator' field. Note whether it is set to a comma (,) or a semicolon (;).
Return to Microsoft Access and rewrite your IIf function using the exact separator specified in your Windows settings. For example, if it is a semicolon, use IIf([Field]=1; 'Yes'; 'No').

Correct Syntax and Formatting in Expression Builder
Ensure that text results are properly enclosed in straight quotation marks and parentheses are balanced.
Try WPS Office for Your Data and Document Needs
While WPS Office does not include a direct database management program like Access, it offers a powerful Spreadsheet application for data analysis, alongside robust Writer and Presentation tools. Enjoy a free, lightweight alternative to Microsoft Office with high compatibility and a familiar interface.

Frequently Asked Questions
Why does the Access Expression Builder show pipe (|) characters in the IIf function?
The pipe characters often appear as placeholders in the Expression Builder's tooltip syntax guide. You should replace these pipes with your system's actual list separator (usually a comma or semicolon) when writing the final formula.
Can I use semicolons instead of commas in the IIf function?
Yes, if your Windows Regional Settings have the 'List separator' defined as a semicolon. This is common in many European locales. Access requires you to use the separator defined by your operating system.
Why am I getting a quotation mark error in my IIf statement?
This error typically occurs if you forget to enclose text strings in double quotation marks within the true or false parts of the function, or if you accidentally pasted formatted 'smart quotes' from a word processor instead of using standard straight quotes.




