DaveHa
asked on
Timer
How about the timer interval limits?
Need call to the Timer control after 10 minutes.
Thanks for help!
Need call to the Timer control after 10 minutes.
Thanks for help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not sure that syntax works - how about:
Private Sub Timer1_Timer()
Static dtmInitialTime As Date
If dtmInitialTime = 0 Then
dtmInitialTime = Now
ElseIf DateDiff(dtmInitialTime, Now, "n") > 10 Then
MsgBox "10 minutes elapsed!!!"
dtmInitialTime = Now
End If
End Sub
- You can set the Interval property to 1000 to check this every second, or higher for less frequent checks.
Private Sub Timer1_Timer()
Static dtmInitialTime As Date
If dtmInitialTime = 0 Then
dtmInitialTime = Now
ElseIf DateDiff(dtmInitialTime, Now, "n") > 10 Then
MsgBox "10 minutes elapsed!!!"
dtmInitialTime = Now
End If
End Sub
- You can set the Interval property to 1000 to check this every second, or higher for less frequent checks.
ElseIf DateDiff(dtmInitialTime, Now, "n") > 10 Then
Error on type....
Error on type....
Set Timer1.Interval = 60000 - one minute
Private Sub Timer1_Timer()
Static Tics as Integer
const factor as integer = 10
Tics = (tics + 1) mod Factor
if tics < 0 then ... do your 10 minute thing here ...
'
End Sub
Private Sub Timer1_Timer()
Static Tics as Integer
const factor as integer = 10
Tics = (tics + 1) mod Factor
if tics < 0 then ... do your 10 minute thing here ...
'
End Sub
OOps! should be
If tics < 1 then ...
Sorry.
I just don't know WHY this type of error happens. I have an error correcting modem...
M
If tics < 1 then ...
Sorry.
I just don't know WHY this type of error happens. I have an error correcting modem...
M
Oups, sorry. A few characters left in somewhere between my head and my fingers!
As other experts had remarked, the correct syntax should be:
Private Sub Timer1_Timer()
Static dtmInitialTime As Date
If dtmInitialTime = 0 Then
dtmInitialTime = Now
ElseIf DateAdd("n", 10, dtmInitialTime) < Now Then
MsgBox "10 minutes had elapsed!!!"
dtmInitialTime = Now
End If
End Sub
As other experts had remarked, the correct syntax should be:
Private Sub Timer1_Timer()
Static dtmInitialTime As Date
If dtmInitialTime = 0 Then
dtmInitialTime = Now
ElseIf DateAdd("n", 10, dtmInitialTime) < Now Then
MsgBox "10 minutes had elapsed!!!"
dtmInitialTime = Now
End If
End Sub
Private Sub Timer1_Timer()
Static dtmInitialTime As Date
If dtmInitialTime = 0 Then
dtmInitialTime = Now
ElseIf DateAdd("n", 10, dtmInitialTime) Then
MsgBox "10 minutes had elapsed!!!"
dtmInitialTime = Now
End If
End Sub