I have weekly reports and in these weekly reports, there is a query that I have to specify a begin date (whatever Monday's date is) and an end date (whatever Sundays date is). I was going to try to instead of manually going into each database to open the query and run the query that way, build a form, and have an onclick event of the button that would execute this code:
And of course, I am opening about 15 different databases, and running the same query in each database. Is there a way to either 1) Only input the start/end date one time at the beginning of the run, and VB code can retain that start/end date and pull data from within that time frame for each subsequent query or 2) somehow programatically build a calander into VBA coding and when the query is run, in VBA have it only pull data for the previous 7 days (altho that sounds like it would be extremely difficult).Code:'Opening the Database Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Test\Test123\Test123db.mdb") 'Running specified queries db.Execute "qry_check_weekly_statistics", dbFailOnError Set db = Nothing.