Select the First Non-Null Field in a Microsoft Access Query
Question details
Return the first non-null value from fields A, B, and C in a Microsoft Access query.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A query should check the fields in order and return A, then B, then C.
- Observed behavior
- Each query result should contain the first non-null value in the specified field order.
Open the Access database and identify the table or query containing fields A, B, and C. Replace those field names in the expressions below if your database uses different names.
Use nested Nz functions in an Access query
Use this concise expression to return A if it is not null, otherwise B, and finally C.
In the Navigation Pane, right-click your query and select Design View. To create a new query, select Create > Query Design and add the table containing the fields.
In an empty Field cell in the design grid, enter: Result: Nz([A], Nz([B], [C])).
Select Run to view the Result column. Each row returns A when available, otherwise B, or C if both A and B are null.

Use nested IIf and IsNull expressions
Use this alternative if you prefer to make each null check explicit.
Work with exported Access data in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface. Export Access data to an Excel workbook, then open it in WPS Spreadsheets for review and editing. WPS does not run Access queries or replace the Access database engine.

Frequently Asked Questions
What happens if all three Access fields are null?
The expression Nz([A], Nz([B], [C])) returns Null when A, B, and C are all Null.
Can I use the Nz expression in SQL View?
Yes. In Access, open the query in SQL View and use an expression such as SELECT Nz([A], Nz([B], [C])) AS Result FROM [YourTable]; replacing YourTable with the actual table name.
Will Nz skip an empty string or zero?
No. Nz replaces Null values, but an empty string or zero is not Null. Use additional conditions if those values should also be skipped.
Can WPS Office run this Access query?
No. Run the query in Microsoft Access. You can export its results to an Excel workbook and open that workbook in WPS Spreadsheets.




