I would advise a couple of things for this...
1. The methodology is not bad but put some allowances to stop the service normally..
Allow the checkandUpdate function to look somewhere ( in your db, an .ini file, or even the registry ) for an off switch. Some put timers in their code for stop and starting.
2. Create either a text file for logging ( myapp.process.log ) or a table in your DB. The text file is preferable in the event the db has stopped running. Place start time, run time and stop time in the log so you can go back and check progression.
3. Allow the logging to be turned on or off.
4. ERROR TRAP - and also write to a log file - preferably even a different file ( myapp.error.log ).
Main Topics
Browse All Topics





by: VBClassicGuyPosted on 2009-10-05 at 13:21:54ID: 25499282
For one thing, EndNow will never change to True because you have no statement to tell it to do so (unless CheckAndUpdateTheDB is a subroutine snd you do it there, AND EndNow is a Public variable.
Secondly, the Sleep function will tie up some processing time. I would use this instead:
Timeout! = Timer + 10 'set timeout
If Timeout! > 86399 Then 'if greater than 23:59:59
Timeout! = 10 'set to tomorrow
End If '(prevents infinite loop @ midnight)
...and...
Do
If Timer > Timeout! Then Exit Do
DoEvents
Loop