Create Dynamic Year and Month Criteria in a Microsoft Access Query
Question details
Filter an Access report by the current year and month or by a period selected on a form.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A query supplies records to a report that needs a dynamic monthly filter.
- Observed behavior
- The report should show records for either the current month or the year and month selected by the user.
Identify the report's record source and the date field to filter. For a user-selected period, create a form with combo boxes that return numeric year and month values.
Filter the Access query to the current month
Use a date range that updates automatically whenever the query or report runs.
In the Navigation Pane, right-click the query used by the report and select Design View.
Add the date field to the query grid if needed. In its Criteria row, enter: >=DateSerial(Year(Date()), Month(Date()), 1) And <DateSerial(Year(Date()), Month(Date())+1, 1)
Save the query, confirm it is selected in the report's Record Source property, and open the report to check the current month's records.

Filter the Access query using year and month form controls
Use this approach when users need to choose the reporting period before opening the report.
Work with monthly data in WPS Office
WPS Office is a free, lightweight alternative for working with familiar Office documents and spreadsheets. Its familiar interface and Microsoft Office format compatibility make it easy to move everyday files, although it does not replace or fix Microsoft Access queries and reports.

Frequently Asked Questions
How do I automatically show the current month in an Access report?
In the report's source query, set the date field's Criteria to >=DateSerial(Year(Date()), Month(Date()), 1) And <DateSerial(Year(Date()), Month(Date())+1, 1). The range updates when the query runs.
Why does Access prompt me for a form control value?
Check that the form is open and that the names in Forms!FormName!ControlName match the actual form and control names. Also confirm that both period controls have values.
Can I filter a report if year and month are stored in separate fields?
Yes. Use equality criteria for each numeric field, such as Forms!frmPeriod!cboYear under the year field and Forms!frmPeriod!cboMonth under the month field in Query Design View.
Should I use Like for the year and month criteria?
No. Use equality for numeric year and month fields, or a DateSerial range for a date field. Like is intended for pattern matching with wildcards.




