Office中国论坛/Access中国论坛

标题: 閞不了ACCESS, 有時候可以, 有時候不行, 請各位大哥幫助一下, 謝謝! [打印本页]

作者: ANDY8    时间: 2013-4-1 12:36
标题: 閞不了ACCESS, 有時候可以, 有時候不行, 請各位大哥幫助一下, 謝謝!
Option Compare Database
Option Explicit

Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type

Private Declare Function GetLastInputInfo Lib "user32" (plii As LASTINPUTINFO) As Boolean

Private Declare Function GetTickCount Lib "kernel32" () As Long
Private m_LII As LASTINPUTINFO

Private Sub Form_Load()
Me.TimerInterval = 1000
End Sub

Private Sub Form_Timer()
m_LII.cbSize = Len(m_LII)
GetLastInputInfo m_LII

If (GetTickCount() - m_LII.dwTime) \ 60000 = Me.txtSeconds Then
If Me.fraOperateType = Me.optLock.OptionValue Then
DoCmd.OpenForm "frmLockSystem"
Else
DoCmd.OpenForm "frmQuitCountdown", OpenArgs:="QuitSystem"
End If
Else
On Error Resume Next
DoCmd.Close acForm, "frmQuitCountdown"
End If
End Sub

Private Sub txtSeconds_AfterUpdate()
If Nz(Me.txtSeconds, 0) <= 0 Then
Me.txtSeconds = 0
Me.TimerInterval = 0
End If
If Me.txtSeconds > 60 Then
Me.txtSeconds = 60
Else
Me.txtSeconds = Int(Me.txtSeconds)
End If
End Sub


----------------------------------
Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)
If Nz(Me.OpenArgs) = "QuitSystem" Then
Me.TimerInterval = 1000
Me.lblCountdown.Caption = 60
Else
Cancel = True
End If
End Sub

Private Sub Form_Timer()
Me.lblCountdown.Caption = Me.lblCountdown.Caption - 1
If Me.lblCountdown.Caption = 0 Then DoCmd.Quit acQuitSaveNone
End Sub




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3