MS Access Idle Timeout is a very useful feature to add it within any Microsoft Access program. You might ask how to detect user idle time or inactivity so as to close any opened Microsoft Access form after a period of time (session timeout).
The answer is very easy though. All what you need to do is to ensure that the opened form has its own timer interval and you set an event procedure on timer. You can set these codes on a hidden form or on your main form.
Setting Timer Interval
On Timer Procedure
VBA Code
Static OldControlName As String
Static OldFormName As String
Static ExpiredTime
Dim ActiveControlName As String
Dim ActiveFormName As String
Dim ExpiredMinutes
Dim TimeIdle As Integer
On Error Resume Next
ActiveControlName = Screen.ActiveControl.Name
ActiveFormName = Screen.ActiveForm.Name
TimeIdle = Nz(DLookup("UserIdle", "tblUser", "UserName='" & Me.UserName & "'"), 5)
TimeIdle = TimeIdle * 100
If (OldControlName = "") Or (OldFormName = "") _
Or (ActiveFormName <> OldFormName) _
Or (ActiveControlName <> OldControlName) Then
OldControlName = ActiveControlName
OldFormName = ActiveFormName
ExpiredTime = 0
Else
ExpiredTime = ExpiredTime + Me.TimerInterval
End If
ExpiredMinutes = (ExpiredTime / 1000)
If ExpiredMinutes >= TimeIdle Then
ExpiredTime = 0
DoCmd.OpenForm "frmLogOut", acNormal
End If
In addition, the downloadable file will also include the sign-In form. You can refer to our post for Microsoft Access Sign-In form here.
To use Microsoft Access Programs.
You’ll need to have Microsoft Office installed including the bundle of MS Access or to download the free Microsoft Access 2016 run-time.
Please check our Pro Microsoft Access Programs here.