task scheduler

shutzy

Registered User.
Local time
Today, 13:39
Joined
Sep 14, 2011
Messages
775
i am having some problems with windows task scheduler. each night i have told the scheduler to run a .dat file to kill the access process, then a few minutes later( i have also tried hours later) to open my access database. it does do it when i first set it up but only once. i have checked that i have selected it to be daily rather than just once.

can anyone offer any help on this or is there more than one way of opening my database.

the reason i want to close my database and then open it is that on open of the 'home screen' vba runs to do daily tasks. i would like to add more like an auto back up etc but im wanting to get this nailed first.

thanks
 
Is there a reason you don't close the db and just let task scheduler open it? I'm not sure I'd just kill the Access process; seems like it would be prone to corrupting the db.

My first option would be to create a utility db that just did your daily tasks and then quit, and call that from scheduled tasks. If the db will always be open, an option would be using the timer event of a form to run the daily tasks, but I'd lean towards the other option.
 
the reason i use a task kill .dat file is that we might not always remember to close it. also i would prefer to fit to always be open. i like the sound of the timer event. i knew that there must be one but never knew anything about it.

you did say however that you would lean more towards the first method. any particular reasons. is there and significant draw backs to the timer option?

thanks
 
i have just had a quick look around at the timer thing. does the timer start from when the database/form opens. if so then if i open the database at 01:00 and want to run a task daily then the timer will have to countdown from 24hrs. but if i open it up at 15:00 then it will run at 15:00 the next day. so i can see a flau in this timer, but i think i have found a solution. is it possible to have a realtime clock and refer to it.

ie.
Code:
If Me.Clock=15:00 then
Docmd.DailyTasks
exit sub

would this be one way of doing this.
 
You might like this type of thing:

http://www.peterssoftware.com/isd.htm

I wouldn't say using the timer has significant drawbacks, but it is a process that is always running, which I prefer to avoid. For a once a day process I'd go the other way. I use the timer event when something has to be done/checked/requeried every minute or five minutes or whatever.

If you want to go the timer way, you can use the Time() function to get the current system time. You'd have to use an appropriate timer interval and probably something to prevent the process from being triggered twice. Also tricky if you have multiple users, or if the database gets closed.
 
thanks for that. i have some failsafes for my daily tasks. i used to have them on open of the database but the task scheduler not working correctly meant that on a sunday and monday when we are not in work the database did not get opened thus the daily tasks not being daily. i have gone down the timer path. i dont mind a process running constantly as the only thing the pc is used for is facebook, twitter and database. nothing else is ever run so i would consider the pc being capable of doing the process. i have got the whole thing automated. my next task will be to go online so i will be posting for the biggest aspect of my project todate shortly.

if you can help in any way with this i would like as much help as possible.

thanks for the timer suggestion.
 

Users who are viewing this thread

Back
Top Bottom