|
该代码工作时显示剩余时间,但所用时间我不知道用什么代码去控制,并能显示在弹出窗口中。代码如下:Private Sub Command60_Click()
Dim a As Long
a = Val("10:00:00")
b = Val(Me.y)
MsgBox "使用时间:" & a - b & "分钟,请计时!"
'DoCmd.Close
End Sub
Private Sub Form_Load()
Me.TimerInterval = 0
If Nz(Me.h) = 0 And Nz(Me.m) = 0 And Nz(Me.s) = 0 Then Exit Sub
Me.TimerInterval = 1000
End Sub
Private Sub Form_Timer()
If Me.s = 0 Then
Me.s = 59
If Me.m = 0 Then
Me.m = 59
Me.h = Me.h - 1
Else
Me.m = Me.m - 1
End If
Else
Me.s = Me.s - 1
End If
Me.y = Nz(Me.h, 0) & ":" & Nz(Me.m, 0) & ":" & Nz(Me.s, 0)
If Nz(Me.h) = 0 And Nz(Me.m) = 0 And Nz(Me.s) >= 1 And Nz(Me.s) <= 5 Then Beep
If Nz(Me.h) = 0 And Nz(Me.m) = 0 And Nz(Me.s) = 0 Then
Me.TimerInterval = 0
MsgBox "时间已到,比赛结束!"
DoCmd.Close
End If
End Sub |
|