Running Qry automatic once per week

H

Hardhit

Hello,

I have a query that I want to run once per week at the first day of the week.
How should I do this ?

This query is then used to send a report via e-mail to other users.
This last is no problem to do but I need to run it manually at this moment.

Regards,
Peter
 
A

Allen Browne

There's a bit more to this question than may be apparrent initially.

Firstly the query doesn't run if you don't open the database. If you can't
be sure that someone will open the database, you may need to create a macro,
create a shortcut to it, and schedule the running of it with something like
the AT command. Alternatively, it might be enough to use the AutoExec macro
in the database so that it runs each time the database opens, to see if the
query has been run for this week or not.

Secondly, we presume that the query needs to be run once only each week. You
will therefore need to create a table to log when the weeks for which the
query has been run. You will therefore want your macro 2 execute 2 queries:
one that runs the query that you have in mind, and a 2nd one that appends a
record to the log table. The macro will begin by examining the log table to
see if it has already been run this week, and jumping out if it has.

Next, you might need to consider what to do if the computer has been off for
a few weeks (e.g. if you go away for holidays.) Does the query need to run
once to bring it up to date? Or should it execute once for each of the weeks
you were away?

Hopefully that gets you thinking in a useful direction.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top