logo
search
Others

How to Use Combo Box and Form Controls in Microsoft Access Queries

Chanuka GeekiyanageChanuka Geekiyanage Oct 9, 2026 869 views

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.

How to Use Combo Box and Form Controls in Microsoft Access Queries
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.
Before you start

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.

Solution 1Recommended

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.

1
Open Query Design View

Open your target query in Design View within Microsoft Access to access the criteria grid.

2
Input the Control Reference

In the Criteria row of the target field, enter the standard reference to your form control: Forms!YourFormName!YourControlName.

3
Allow Blank Inputs (Optional Filtering)

To make the filter optional, modify the criteria to accept null values: [YourFieldName] = Forms!YourFormName!YourControlName OR Forms!YourFormName!YourControlName Is Null.

4
Support an '<All>' Selection

If your combo box contains a specific '<All>' option, expand your logic to include it: OR Forms!YourFormName!YourControlName = "<All>".

5
Combine Independent Filters

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.

Reference Form Controls Directly in Query Criteria
Query Performance Tip: Prefer equality comparisons (=) over LIKE expressions. Using LIKE with wildcards can prevent the Access database engine from utilizing indexes, which significantly reduces query execution speed on large tables.
Free Microsoft Office alternative

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. 1. Download and Install: Visit the official WPS website and download the free WPS Office suite for your operating system.
  2. 2. Open Existing Office Files: Launch WPS Office and directly open your existing Excel spreadsheets, Word documents, or PowerPoint files.
  3. 3. Organize Data Seamlessly: Use WPS Spreadsheet's advanced filtering and data validation tools to manage your records effortlessly.
Fully compatible with Microsoft Office formats including .docx, .xlsx, and .pptx.Powerful spreadsheet features to organize, filter, and query data easily without needing a full database.Free and lightweight, consuming minimal system resources.Familiar user interface for a seamless transition from MS Office.
microsoft office alternative - wps office

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.