|
[求助]如何强制用户到了一定时间退出系统?以防止非正常关机导致的数据库破坏
Dim a, bb As Integer
Private Sub Form_Load()
If Time() < #1:13:35 PM# Then
Me.TimerInterval = 0
Else
Me.TimerInterval = 1000
a = 0
bb = 0
End If
End Sub
Private Sub Form_Timer()
If Time() > #1:13:35 PM# Then
bb = bb + 1
a = a + 1
If a = 2 And bb < 3 Then
If MsgBox("现在是非工作时间,系统将会自动关闭" & vbCr & vbCr & "请输入延时密码", vbInformation + vbOKCancel, "防止未正常关闭的数据破坏") = vbCancel Then
MsgBox "未输入密码,操作被取消,现在将关闭系统", vbInformation, "警示"
DoCmd.Quit acPrompt
ElseIf InputBox("现在是非工作时间,系统将会自动关闭" & vbCr & vbCr & "请输入延时密码", "防止恶意的数据破坏") = "jessie" Then
Me.TimerInterval = 0
Exit Sub
ElseIf bb = 3 Then
'输入密码延时3秒后,将强制关闭系统,可是这代码没起作用啊
DoCmd.Quit acPrompt
Else
MsgBox "密码错误,现在将关闭系统", vbInformation, "警示"
DoCmd.Quit acPrompt
End If
End If
End If
End Sub
|
|