Update Microsoft Access Query Dates via Form or Table
Question details
The user needs to dynamically update the date range (such as a fiscal year from December 1 to November 30) in a Microsoft Access query so users can modify it easily without accessing the query design.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Calculating billable hours for a specific accounting year that changes annually.
- Observed behavior
- The user needs a safe method for end-users to update accounting year dates automatically or manually without exposing backend database objects or hard-coding criteria.
Before modifying your database structure or query criteria, ensure you create a backup copy of your Microsoft Access file to prevent accidental data loss during the configuration process.
Create and Use a One-Row Settings Table
Store your accounting year start and end dates in a dedicated settings table. This allows users to update dates via a simple bound form without touching the query design.
By utilizing a one-row table without joins, Access will apply these settings universally across your query as a Cartesian product. Restricting the table to a single row guarantees data integrity.
Create a new table named 'tblSettings' with two Date/Time fields: 'StartDate' and 'EndDate'.
Add a Primary Key field. In the field properties, set its default value to 1, and add a Validation Rule of '=1'. This prevents users from adding more than one record.
Open the table in Datasheet View and enter the current accounting year dates (e.g., 12/1/2022 to 11/30/2023) into this single row.
Open your target calculation query in Design View, click 'Add Table', and include 'tblSettings'. Do not create any relationship lines (joins) to other tables.
In the query design grid, navigate to your transaction date field. Update the Criteria row to reference the settings table, for example: '>=[tblSettings].[StartDate] And <=[tblSettings].[EndDate]'.
Build a simple user form bound to 'tblSettings'. Users can now safely open this form to update the date range next year without seeing the query design.

Use a Custom VBA Function (AcctYear)
Create a custom VBA function to dynamically calculate and compare the transaction accounting year with the current accounting year.
Looking for a Reliable and Free Office Suite?
While WPS Office does not feature a database management tool like Access, it serves as a powerful, lightweight, and free alternative to Microsoft Office for your document, spreadsheet, and presentation needs. Experience familiar interfaces and high compatibility without the hefty subscription fees.

Frequently Asked Questions
Why is it dangerous to let users modify query design in Access?
Allowing end-users to modify the underlying query design can lead to accidental deletion of database objects, corrupted criteria, or exposure of sensitive data structures. Using forms bound to a settings table is a much safer, controlled alternative.
What does a validation rule of '=1' do in an Access settings table?
Setting a validation rule of '=1' on the primary key field ensures that users can only ever create a single row in that table. This prevents duplicate configuration records, ensuring the query always references exactly one set of start and end dates.
Can I use this one-row table method without joining it to other tables?
Yes. By adding the one-row settings table to the query design without joining it to your main data tables, Access creates a Cartesian product. Since the settings table only has one row, it safely applies those same date variables to every row in your data query without duplicating results.




