Query - Automatically change month in query field based on system date

BPERELLA

New member
Local time
Yesterday, 22:35
Joined
Feb 10, 2022
Messages
7
Hello. I have a form based on a query which gets the current month's value and uses it in the form to calculate a field. This is a multi-user database. and I have to remember to go into the database on the first of the month to change the query field used in the form calculation. I am struggling to figure out a way to do this automatically based on the current month in the system date. The field from the query used in the calculation is called "SumOfSumOfApr" which today I changed to
"SumOfSumOfMay" Thanks for you help.

This was my first thought which oviously doesn't work:

1651509541994.png
 
Just call it SumOfMonth and use the Month() function on Date()
 
Database normalization applies to queries as well:


You need to set up your queries so they don't need maintenance. My guess is, come 1/1/2023 you're gonna have to edit a few queries to get this thing to work. If you make it such that the data you need to use (either the values or to apply criteria) are in fields, it makes life so much simpler.

Query1b should not have a field for every month, it should have a month field where you store that value. And a year field so that you never have to go into its design view again. Life in the future could be so much simpler if you set this thing up correctly now.
 

Users who are viewing this thread

Back
Top Bottom