mattydalton
07-07-2008, 08:35 AM
Hi everyone,
I have a set of queries that I run each day and I would like to be able to automate the running of them. I am currently using MS Access 2000. I have already created the Macro and am aware that I will probably need to create some kind of code but have no idea where to start. I would like to set my macro to run at 6am each morning.
Can anyone help?
Thanks
Matt
pbaldy
07-07-2008, 08:37 AM
Welcome to the site. What I would do is create a separate version of your application and name that macro "autoexec" so it runs when the application is started. Add a line to the macro that quits the application at the end. Then start that application from Scheduled Tasks on the appropriate schedule.
mattydalton
07-07-2008, 08:39 AM
Sorry to be a bit dumb but how do you do that? I only started using Access about a month ago!
pbaldy
07-07-2008, 08:43 AM
Do what specifically? Create a separate version? It's a file like any other. Go into Explorer and copy it. Name the copy "QueryRunner" or whatever has meaning to you. Make the other changes and run it from Scheduled Tasks.
mattydalton
07-07-2008, 08:44 AM
Are you saying make a copy of the macro?
pbaldy
07-07-2008, 08:54 AM
No, the entire application (mdb), though depending on your specifics you may only need the macro and the queries. I'm assuming the application is split, which I just realized is a bad assumption. If the tables are local to your application, you would need to link to them in this separate application.
I just realized another option is to use a command line switch to open the application and run your macro. If you leave it named whatever it is and add the line to quit the application at the end, you can probably just call your existing application from Scheduled Tasks and specify that macro to run. Look at "Startup command-line options" in Help for more on that.
mattydalton
07-07-2008, 08:55 AM
Thanks, I will have a look now