Fix an Access IIf Default Value Expression That Always Returns False
Question details
The user needs to compare FROM_USER_NAME with the text tacpk and return the appropriate result for each record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A table field has an IIf expression in its Default Value property that refers to another field in the same record.
- Observed behavior
- The expression returns the false result even when FROM_USER_NAME contains tacpk.
Open the table in Access and confirm the exact field name and table name. Check that the value to compare is the text tacpk and note the true and false results you want.
Calculate the IIf result in an Access query
Use a query when the result should reflect the current value of FROM_USER_NAME in each record.
A table field's Default Value property is not the appropriate place to calculate a value from another field in the same record. A query evaluates the expression against each row and avoids storing a calculated value unnecessarily.
In Access, select Create > Query Design and add the table containing FROM_USER_NAME.
In an empty Field cell in the query design grid, enter: IsTacpk: IIf([FROM_USER_NAME]="tacpk", True, False). Replace True and False with your desired results if needed.
Click Run and compare the IsTacpk results with the values in FROM_USER_NAME. Add FROM_USER_NAME to the grid if it is not already visible.
If the table field no longer needs that default, open the table in Design View, select the field, and clear its Default Value property.

Work with Office documents and spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents, spreadsheets, and presentations. Its format compatibility makes it easy to move everyday files from Microsoft Office, though it does not fix Access database expressions.

Frequently Asked Questions
Why does the table default value return False?
A table Default Value expression is not designed to reliably read another field in the current record. Calculate the comparison in a query using [FROM_USER_NAME] instead.
How do I show a label instead of True or False?
In the query design grid, enter an expression such as Result: IIf([FROM_USER_NAME]="tacpk", "Match", "No match"). Change the two labels to suit your needs.
What if the query still shows no match?
Add FROM_USER_NAME to the query results and inspect the stored value for extra spaces or other differences. Also confirm that the field name in the expression matches the table field.
Will changing the default update existing records?
No. The Default Value property applies when new records are created; changing it does not recalculate existing stored values. Use a query to display a current calculated result.




