Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause my application for 20 mins

Status
Not open for further replies.

GlenLynam

MIS
Jul 26, 2002
121
Morning,

I am building an application that i need to run every 30 mins. The code works fine i just need it to run as above. I looked at the timer but this can apparently only handle up to 65 secs which is way short of my target. A sheduled task doesnt appear to be able to run more than once a day. I thought about adding a clock and running whenever the time was at 00 or 30, but was unsure as to how to do this.

Does anyone have any ieas???

Thanks

Glen
 
Hi..

Maybe this code can help you??

You make a variable, lets call it Timm%

If your timer is called Timer1 set the interval to 60000 = 60 sec = 1 minute

Sub Timer1()

Timm = Timm + 1
If Timm > 29 then ' Exactly 30 minutes has gone
'Timer1.enabled=False ' disconnect the timer
DoTheJob ' run your prosedure
Timm = 0 ' reset the variable
'Timer1.enabled=True ' reconnect the timer
End if
End Sub

If you dont disconnect the timer while your procedure is running, you will get exactly 30 minutes between each time the timer activates..

 
Have a look at some of these previous solutions:

thread222-901069
thread222-845556

You might also consider using the Windows scheduler

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

Essex Steam UK for steam enthusiasts
 
What OS are you using? With Windows 2000, if you use the scheduled task wizard you cannot set the frequency to a more granular level than once/day until you click the finish tab. Once you do that, you'll have access to an "advanced" button on the Scheduled section of the form. From there you can schedule based on hours or minutes.
 
The Timer function (not Control) returns the number of seconds since midnight so you could check the value of that periodically (say once a minute) maybe using a Timer control.

Dim SecondsSinceMidnight as Single
SecondsSinceMidnight = Timer

regards Hugh

 
Thanks for all the responses in the end i went for ERIKSENU (Programmer)'s answer works a treat.

Glen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top