05/07/2009, 16:34
Private Sub Form_Timer()
On Error GoTo err_Form_Timer
Const IDLEMINUTES = 5
Static PrevControlName As String
Static PrevFormName As String
Static ExpiredTime
Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes
On Error Resume Next
ActiveFormName = Screen.ActiveForm.name
If err Then
ActiveFormName = "No Active Form"
err = 0
End If
ActiveControlName = Screen.ActiveControl.name
If err Then
ActiveControlName = "No Active Control"
err = 0
End If
If (PrevControlName = "") Or (PrevFormName = "") _
Or (ActiveFormName <> PrevFormName) _
Or (ActiveControlName <> PrevControlName) Then
PrevControlName = ActiveControlName
PrevFormName = ActiveFormName
ExpiredTime = 0
Else
ExpiredTime = ExpiredTime + Me.TimerInterval
End If
ExpiredMinutes = (ExpiredTime / 1000) / 60
If ExpiredMinutes >= IDLEMINUTES Then
ExpiredTime = 0
ZAMAN DOLDUĞUNDA YAPILMASI İSTENEN
End If
exit_Form_Timer:
DoCmd.Hourglass False
Exit Sub
err_Form_Timer:
MsgBox err.Description
Resume exit_Form_Timer
End Sub