Set Message to go off every 30 minutes

Djblois

Registered User.
Local time
Yesterday, 23:36
Joined
Jan 26, 2009
Messages
598
Is there a way I can run some code every 30 minutes. i was looking at Form_Timer. What code would I need to get it to run every 30 minutes?
 
The form timer would be running constantly but the INTERVAL is what you are looking for. 1 second is equal to 1000 in the timer interval. So, for 30 minutes you would set that to be 1800000.
 
The Interval is what determines when the code in the timer event fires.
 
so would this be correct

Code:
me.timeinterval = me.timeinterval - 1800000

and after that goes off - would it go off in again in another 30 minutes?
 
so would this be correct

Code:
me.timeinterval = me.timeinterval - 1800000

and after that goes off - would it go off in again in another 30 minutes?

No, just set at 1800000

It will go off every 30 minutes. If you want it to wait to start counting the 30 minutes again while you do something and THEN want the timer to start counting down to the next 30 minutes you would set the Me.TimerInterval = 0 at the start of whatever you are doing and then reset it back to

Me.TimerInterval = 1800000

when you want the 30 minute countdown to start again.

Does that make sense?
 
so do I put the Me.TimerInterval = 1800000 code in the Form_timer event or in the form_load event. and then just put the code that I want to run in the form_timer event?
 
Okay, let's visit this again.

In the PROPERTIES DIALOG of the form go to TimerInterval and put 1800000. Now the timer event will fire every 30 minutes when the form is opened. Does the code you want to run every 30 minutes take longer than a few seconds to run? If not, then don't do anything else.

If it does then in the On Timer EVENT, put Me.TimerInterval = 0 to stop the timer - the rest of your code you want to run goes in the ON TIMER event as well. At the end of that code, just before the exit of the On Timer event, put the Me.TimerInterval = 1800000 so it starts again.
 

Users who are viewing this thread

Back
Top Bottom