Create a Month and Year Parameter Query in Microsoft Access
Question details
Let users enter a month and year once when running an Access query that contains four subqueries.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A query combines results from four payment tables, and each subquery currently uses hard-coded month and year values.
- Observed behavior
- The goal is to prompt for one month and one year and apply those values throughout the query.
Open the database and locate the query and its four subqueries. Check where each subquery filters by month and year so you can replace every hard-coded value.
Use shared month and year parameters in all four subqueries
Replace the fixed values with identically named parameters and declare their data types so Access can reuse the entered values.
In the Navigation Pane, right-click the query and select Design View. Switch to SQL View from the View menu if the subqueries are easier to edit in SQL.
In each of the four subqueries, replace the hard-coded month criterion with [Enter Month] and the hard-coded year criterion with [Enter Year]. Keep the parameter names identical everywhere they appear.
In Query Design view, select Design > Parameters. Enter Enter Month and Enter Year exactly as used in the query, and set each Data Type to Long Integer.
Save the query, then select Run. Enter a numeric month from 1 to 12 and a four-digit year when prompted, and check that the results include the expected payments.

Work with payment spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents and spreadsheets. It can help you review payment data exported from Access, but it does not run or fix Access database queries.

Frequently Asked Questions
Will Access prompt for the month and year only once?
Access can reuse each entered value throughout the query when every occurrence uses the exact same parameter name. Declare both names under Design > Parameters.
What should I enter for the month parameter?
Enter a number from 1 through 12 when the Enter Month prompt appears. The query must compare that parameter with a numeric month value.
Why does Access show an unexpected parameter prompt?
A misspelled parameter or field name can cause another prompt. Check the names in all four subqueries and compare the parameter names with those listed under Design > Parameters.
Can WPS Office run my Access parameter query?
No. Run the query in Microsoft Access. If you export its results to an Excel file, you can open and review that file in WPS Spreadsheet.




