Include Null Values in Microsoft Access Combo Box Query Criteria
Question details
The user needs an Access query that filters a subform using a combo box while accounting for null values.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A combo box on a filter form supplies a text criterion for records displayed in a subform.
- Observed behavior
- The Like criterion matches populated fields but excludes records whose filtered field is null.
Identify the query's text field, the filter form and combo box names, and the subform control name. Confirm whether null field values should appear only when the combo box is blank or also when a filter value is selected.
Add null conditions to the Access query
Use this approach to show all records when the combo box is null and optionally include null field values when a filter is selected.
The combo box null condition and the field null condition serve different purposes: the first removes the filter when no value is selected; the second includes records with a null field even when a value is selected.
In the Access Navigation Pane, right-click the query used by the subform and select Design View. Open SQL View from the View menu.
In the WHERE clause, use: ([Routine] Like "*" & [Forms]![frmIncidentFilter]![cboRoutine] & "*" Or [Forms]![frmIncidentFilter]![cboRoutine] Is Null). Replace the field, form, and control names with the names in your database. If a WHERE clause already exists, combine the condition with the existing criteria as appropriate.
If records with a null Routine field must also appear when a value is selected, add Or [Routine] Is Null inside the parentheses. Omit this condition if null fields should appear only when the combo box is null.
Save the query, open the filter form, and select a combo box value. If the subform does not update automatically, add Me![YourSubformControl].Form.Requery to the combo box's After Update event, replacing YourSubformControl with the subform control name.
Select a value in the combo box, then clear it and move focus away. Check that matching records appear and that a null combo box shows all records, including those with a null filtered field.

Work with exported Access data in WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with Office documents through a familiar interface. Export Access data to an Excel workbook to move it into WPS Spreadsheets; WPS does not replace or repair Access queries, forms, or database relationships.

Frequently Asked Questions
Why doesn't Like "*" match a null field in Access?
A null field represents missing data rather than text, so a Like pattern does not match it. Add an Or [FieldName] Is Null condition when those records must be included.
How do I show all records when the combo box is blank?
Add Or [Forms]![frmIncidentFilter]![cboRoutine] Is Null to the query's filter condition. Replace the form and control names with your own, and verify that clearing the combo box leaves its value null.
Will the combo box null condition always include null field values?
No. It includes all records when the combo box itself is null. To include null fields even when a value is selected, also add Or [FieldName] Is Null.
Why doesn't the subform refresh after I choose a value?
Requery the subform from the combo box's After Update event using Me![YourSubformControl].Form.Requery. Use the name of the subform control on the main form, which may differ from the form object's name.




