I'm trying to implement a basic idle timeout based on the MSDN article and I'm having an issue...
My code is as follows:
Code:
Private Sub Form_Load()
Me.TimerInterval = 1000
End Sub
Private Sub Form_Timer()
Const conIdleMinutes = 10
Static strPrevForm As String
Static strPrevControl As String
Dim strActiveForm As String
Dim strActiveControl As String
Dim timExpiredMinutes
On Error Resume Next
strActiveForm = Screen.ActiveForm.Name
strActiveControl = Screen.ActiveControl.Name
If Err Then
strActiveForm = "No Active Form"
Err = 0
End If
If strPrevForm = "" Or strPrevControl = "" Or strActiveForm <> strPrevForm Or strActiveControl <> strPrevControl Then
strPrevControl = strActiveControl
strPrevForm = strActiveForm
TempVars!varexpiredtime = 0
Else
TempVars!varexpiredtime = TempVars!varexpiredtime + Me.TimerInterval
End If
timExpiredMinutes = (TempVars!varexpiredtime / 1000) / 60
If timExpiredMinutes >= conIdleMinutes Then
TempVars!varexpiredtime = 0
DoCmd.OpenForm "frmTimeoutDialog"
End If
End Sub
I open the form and the timer never runs... checking the values in the immediate window show that the variables are never assigned.
It doesn't even appear that timerinterval is being defined... What am I doing wrong?
I've done it in VBA above, as suggested, as well as tried the form properties.
Access 2016.