How to Fix Microsoft Access Query Expression Errors with Form Date Criteria
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.
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.
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.
In Access, open the query that contains the WHERE clause with the Department and ProductionDate criteria.
Temporarily remove the date range criteria, keep DetailsUnion.Department=1, and run the query to confirm it works.
Replace the form references with hard-coded dates, such as Between #1/1/2024# And #12/31/2024#, and run the query again.
Verify Form and Control Names and Enter Valid Date Values
Use this when the query runs with hard-coded dates but fails with form date criteria.
Add Parameter Declarations and Confirm the Date/Time Field Type
Use this if Access still cannot determine the parameter values after the form and date values are verified.
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.

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.




