Others

How to Fix Microsoft Access Query Expression Errors with Form Date Criteria

Algirdas JasaitisAlgirdas Jasaitis Nov 13, 2026 870 views

Question details

The user needs to resolve a Microsoft Access query expression error that occurs when a query references form controls for a date range.

Product
Microsoft Access
Device & OS
not provided
Scenario
Running a query that filters records by a date range entered in form controls, while also filtering by Department.
Observed behavior
Access reports that it does not recognize the expression when the query uses [Forms]![Stats]![FromDate] and [Forms]![Stats]![ToDate] criteria.
Before you start

Open the Access database and the Stats form before running the query, and confirm in table Design view that ProductionDate is set to the Date/Time data type.

Solution 1Recommended

Isolate the Date Criteria by Testing Department and Hard-Coded Dates

Use this first to determine whether the form date criteria or another part of the query causes the error.

The error often comes from a bad form reference or an invalid date value. Removing variables one at a time makes the cause clear.

1
Open the query in Design view

In Access, open the query that contains the WHERE clause with the Department and ProductionDate criteria.

2
Test the Department criterion alone

Temporarily remove the date range criteria, keep DetailsUnion.Department=1, and run the query to confirm it works.

3
Test with hard-coded dates

Replace the form references with hard-coded dates, such as Between #1/1/2024# And #12/31/2024#, and run the query again.

Isolation step completed: If the query works with hard-coded dates but fails with form references, the issue is the form control reference or its value.
Free Microsoft Office alternative

Use WPS Office for Easier Date Filtering and Reporting

Microsoft Access query expression errors need to be fixed inside Microsoft Access. If you want a free, lightweight Office alternative for everyday data filtering and reporting, WPS Office supports familiar spreadsheet tools and opens Microsoft Excel files with high compatibility, so you can migrate without losing your workflow.

Avoid complex Access query expression errors by filtering date ranges visually in WPS Spreadsheets.Free and lightweight Office suite that runs on Windows, macOS, Linux, Android, and iOS.High compatibility with Microsoft Excel .xlsx files for opening, editing, and saving workbooks.Familiar ribbon interface and formula support for a seamless switch from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Access say it does not recognize the expression when I use [Forms]![Stats]![FromDate]?

This usually means a form or control name is misspelled, the form is not open, or the control does not contain a valid date. Check the Name property of the Stats form and the FromDate and ToDate controls, and open the form before running the query.

How do I test whether the date criteria is causing the query error?

Open the query in Design view and test the Department criterion by itself. Then replace the date form references with hard-coded dates such as #1/1/2024# and #12/31/2024#. If the hard-coded version runs, the form date reference is the problem.

Does ProductionDate need to be a Date/Time field?

Yes. Open the underlying table in Design view and set ProductionDate to Date/Time. If it is stored as Text, Access may not evaluate the Between date range correctly.

Do both form controls need to contain valid dates for the query to work?

Yes. Open the Stats form in Form view, enter valid dates in both FromDate and ToDate, and keep the form open. Null or text values can cause the expression error.

Can parameter declarations fix Access date criteria errors?

Parameter declarations help Access treat the form values as DateTime data types. In SQL view, add PARAMETERS [Forms]![Stats]![FromDate] DateTime, [Forms]![Stats]![ToDate] DateTime; before the SELECT statement.