Guys - TIMED EVENTS - Any takers?

paulmcdonnell

Ready to Help
Local time
Today, 17:09
Joined
Apr 11, 2001
Messages
167
Hi Guys,


how do I get an event to occur in my database program at a predefined time during the day.

Is this dependant on a form being open or not?

(what I want to do is: at 17:30 each day, access automatically backs up the tables in the dbase).

Another quesstion :How do you run a save/backup routine which identifies only the tables?


Hope you can help

CHEERS
Paul!!!!
 
If your intention is to operate something in the way of an unattended backup, there is a way. You can run queries and code (and other things) from macros, so read up on macros.

The requirement would be to build a macro that does what you want. I.e. copy your tables from point A to point B, which includes the idea that point B might be external files of some sort. If there are any preparatory steps (like erasing the stuff at point B beforehand), that has to be in the macro, too.

What I personally would do is to build the queries and code that I needed, set up so that I could run them by hand one step at a time. I would test each step. Then I would build the macro to run the parts in proper sequence. Then I would hand-run the macro a couple of times to verify that it really does what I wanted. I would also try to add in some error handling steps if at all possible, though in a macro that is somewhat limited.

OK, now, having that macro, I would use the Windows Task Scheduler to trigger an Access activation. In the command line implied by the activation (and Task Scheduler WILL let you edit this, trust me), I would make sure I got the path to Access and to the database right, then I would add the /x {macro-name} in that command line. Look up command-line switches under Access Help to get the syntax exactly right.

Now, the last thing you need to do to make this work right is to assure that the last step of the macro is a Quit command. That will close Access automatically after all the other steps are done.

Inside this macro, remember your two best friends are going to be RunQuery and RunCode, because they give you a way to do append or delete queries and to do complex recordset operations if needed.

But you also can have friends such as TransferSpreadSheet and TransferText if that is the nature of your backup.

You will have some research to do, I'm sure, but this should get you pointed in the right direction.
 
Concur with Pat.

Debug it procedurally as a macro.

Then, if you can stand the implied VBA work, convert it to code.

But the catch is that to do this automatic activation externally, you will STILL need a macro to be run from the command line. Only now, the only thing it in will be the RunCode that activates your converted-to-code macro that now has better error handling abilities.
 

Users who are viewing this thread

Back
Top Bottom