I would like a command button on a form to run a query based on the day of the week.
If today is Monday I wish to run Query1
If today is Tuesday I wish to run query2, etc.....
Use VBA code to get the current day of the week, then you can use a series of if statements (or a select statement which is more efficient and better form, but not my personal style) to call the appropriate query.
in pseudocode:
If TodayIsSunday then
DoCmd.OpenQuery "SundayQuery"
elseif TodayIsMonday then
DoCmd.OpenQuery "MondayQuery"
...
End If
I forget which function returns the current day of the week. I'm thinking DatePart or something like that, but I may be way off. Check the help files for that part.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.