i need timer interval more than 1 Minute.

  • Thread starter Thread starter Tark Siala
  • Start date Start date
How about something like:

Sub Main()

Dim datStart As Date


myTimer.Interval = 10000 ' every 10 seconds
datStart = DateTime.Now()
Private Sub myTimer_Timer()
If DateTime.Now().SubTract(datStart).Minutes > 1 Then
datStart = DateTime.Now()
RunFunction()
End If
End Sub

End Sub
 
wholly agreed that the timer is not that exact or relaible. if you set interval to 1 second (1000 ms), then there are 60 intervals
to accumulate error and mishaps. over a few hours or days it adds up.

ken's use of datedif is so much more solid and relies on the system clock, often one that is synched with external servers nowadays.
and less affected by code interrupts.

short run programs (on the spot office stuff) may be suitable for less exact synched code, but with most stuff now related to
internet and multiple user/client/server interaction, i would recommend Ken's suggestion.
 
Back
Top