Last updated: August 29, 2026.
A query can read criteria from controls on an open form. This gives users date pickers, validation, and dropdowns instead of a sequence of plain parameter prompts.
Reference controls from the query
For a form named frmReportFilter with txtStartDate and txtEndDate controls, use fully qualified references.
PARAMETERS [Forms]![frmReportFilter]![txtStartDate] DateTime,
[Forms]![frmReportFilter]![txtEndDate] DateTime;
SELECT OrderID, CustomerID, OrderDate
FROM Orders
WHERE OrderDate >= [Forms]![frmReportFilter]![txtStartDate]
AND OrderDate < DateAdd("d", 1,
[Forms]![frmReportFilter]![txtEndDate])
ORDER BY OrderDate;Make a selection optional
Nz can turn a blank combo box into a wildcard criterion. This example returns every region when cboRegion is empty.
SELECT CustomerID, CompanyName, Region
FROM Customers
WHERE Region = [Forms]![frmReportFilter]![cboRegion]
OR [Forms]![frmReportFilter]![cboRegion] Is Null;Open the form first
The referenced form must be open when the query runs. Validate that the start date is not later than the end date before opening a report. Declare parameter types from Query Design so crosstab queries and report record sources resolve the controls correctly.
Validate the form before running the query
The referenced form must be open, and each control should contain a value of the expected type. Validate date order and required selections in the form before opening a report or export.
Test blank optional controls, an end date containing time, and a form that is closed. Declare parameter types in the query so Access does not interpret date or numeric input as text.
- Use fully qualified Forms references.
- Prefer stable control names.
- Keep business validation in one reusable place.
Use realistic sample data that includes Nulls, ties, and boundary dates. Save a copy before converting a SELECT query into an action query, and compare row counts before relying on the result.
Continue with date range queries, crosstab queries, and DateSerial reference.
Practical implementation check
Build and save the SELECT version before using the result in a form, report, export, or action query. Test records containing Nulls, duplicate sort values, missing dates, and boundary dates. For larger tables, compare execution with appropriate indexes and avoid wrapping an indexed field in a formatting function when ordinary range criteria can do the same work.
Reference: Microsoft parameter query guide.