Gustav Brock
Gustav at cactus.dk
Fri Sep 12 10:01:40 CDT 2008
Hi Tony You could skip all the string handling and use a static variable. Private Sub Form_Timer() Static datLast As Date Dim datNow As Date datNow = Now If DateDiff("s", datLast, datNow) > 5 Then ' Do something. Me!BTime.Value = datNow datLast = datNow End If End Sub Set the format property of BTime to short time. /gustav >>> iggy at nanaimo.ark.com 11-09-2008 16:44:53 >>> Hey All I am trying to trigger an event when the current time = the calculated time. I have been fiddling with this, as previous versions would trip up every so often (ie. after 28 hours). The current version has been running for 3 days and everything seems to be working fine, just wanted to check with the time experts if I am doing this correctly. Me!BTime - unbound on form Timer = 1000 Private Sub Form_Open(Cancel As Integer) Me!Btime = cstr(Format(TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 5), "long time")) End Sub Private Sub Form_Timer() If cstr(Format(TimeSerial(Hour(Now()), Minute(Now()), Second(Now())), "long time"))> cstr(Format(TimeSerial(Hour(me!BTime), Minute(me!BTime), Second(Me!Btime)), "long time")) Then Me!BTime = cstr(Format(TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 5), "long time")) End If End Sub