How to Use Combo Box and Form Controls in Microsoft Access Queries
Question details
The user needs to configure a Microsoft Access query to accept combo boxes and text boxes as optional parameters without relying on macros, while maintaining optimal database performance.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Filtering query results dynamically using user input from a form's combo boxes or text boxes.
- Observed behavior
- The query needs to dynamically filter records based on form controls, accommodating blank inputs or an 'All' option without sacrificing database index utilization and speed.
Ensure your Microsoft Access form is saved and take note of the exact Form Name and Control Names you plan to use as query parameters.
Reference Form Controls Directly in Query Criteria
Use standard SQL logic in the Access Query Design view to reference form controls, allowing for optional filtering without the need for VBA macros.
You can natively reference text boxes and combo boxes in your query criteria. By using logical operators like OR and IS NULL, you can make these filters optional. This means the query will seamlessly return all records if the user leaves the control blank or selects an '<All>' option, bypassing the need for complex macro programming.
Open your target query in Design View within Microsoft Access to access the criteria grid.
In the Criteria row of the target field, enter the standard reference to your form control: Forms!YourFormName!YourControlName.
To make the filter optional, modify the criteria to accept null values: [YourFieldName] = Forms!YourFormName!YourControlName OR Forms!YourFormName!YourControlName Is Null.
If your combo box contains a specific '<All>' option, expand your logic to include it: OR Forms!YourFormName!YourControlName = "<All>".
If you are filtering across multiple form controls, place each independent condition in a separate column in Design View, which combines them using the AND operator.

Looking for a Free, Lightweight Office Suite?
While Microsoft Access is built for complex relational databases, most daily office tasks rely on documents, spreadsheets, and presentations. WPS Office is a highly compatible, free alternative to Microsoft Office that easily handles data processing and formatting in a single, lightweight application.
- 1. Download and Install: Visit the official WPS website and download the free WPS Office suite for your operating system.
- 2. Open Existing Office Files: Launch WPS Office and directly open your existing Excel spreadsheets, Word documents, or PowerPoint files.
- 3. Organize Data Seamlessly: Use WPS Spreadsheet's advanced filtering and data validation tools to manage your records effortlessly.

Frequently Asked Questions
Why is my query running slowly when filtering by form controls?
Query performance often degrades if you use LIKE expressions (e.g., LIKE '*' & Forms!FormName!ControlName & '*') because it prevents the database engine from utilizing field indexes. Stick to strict equality (=) or IS NULL logic for better speed.
Do I need to write a VBA macro to use a combo box in an Access query?
No, you do not need VBA macros for basic parameter filtering. You can directly reference the form controls in the query's Design View using the Forms!FormName!ControlName syntax.
How do I make the query return all records when a text box is left empty?
Add an IS NULL condition to your query criteria. For example, using (YourField = Forms!YourForm!YourTextBox OR Forms!YourForm!YourTextBox Is Null) evaluates to true for all records when the text box contains no value.




