Использование таймера в форме (Начинаем, продолжаем - останавливаем)
Код из примера:
Option Explicit
Private dTimeStart As Date
Private dFormTimeStart As Date
Private Sub cmdClear_Click()
dTimeStart = Now
dFormTimeStart = 0
Me!txtTime = 0
Me!txtTimePassed = 0
End Sub
Private Sub cmdStart_Click()
dTimeStart = Now
dFormTimeStart = Nz(Me!txtTime, 0)
Me.TimerInterval = 100
End Sub
Private Sub cmdStop_Click()
Me.TimerInterval = 0
End Sub
Private Sub Form_Current()
cmdStop_Click
End Sub
Private Sub Form_Timer()
Dim dFormTime As Date
Dim dTimePassed As Date
dTimePassed = Now - dTimeStart
Me!txtTimePassed = dTimePassed
dFormTime = dFormTimeStart + dTimePassed
Me!txtTime = dFormTime
End Sub
MSA-2000 + MSA-2007 ( 58 kB) Пример
|