Idle Detect/Inactivity Timeout

[ Main | AccessTips ]

(Created 2010-09-03)

Exiting the user after 30 or 60 minutes of inactivity is, in my opinion, a good thing.  If you are using a Microsoft Access database file to store your data then you know you can get into the backend to make schema changes.   Also you will know that the nightly backup will proceed relatively cleanly.   And basically just to ensure that if anything "interesting" happens over night that the user is out of the application. 

Start with the code at How to detect User Idle Time or Inactivity in Access 2000

However we found that the code which runs on the timer event must be disabled for the programmers. Otherwise weird things start happening when you're editing code. If you distribute your Access database front end (FE) file as a MDE/ADE/ACCDE you can use the IsMDE function to turn on the timer event.

Public Function IsMDE() As Boolean

Dim db As DAO.Database

On Error GoTo tagError

    Set db = CurrentDb
    If db.Properties("MDE") = "T" Then
        IsMDE = True
    End If
tagNoProperty:
    db.Close: Set db = Nothing

    On Error GoTo 0
   Exit Function

tagError:
    Select Case Err.Number
    Case 3270 ' Property not found
        IsMDE = False
        Resume tagNoProperty
    Case Else
        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure IsMDE of Module mdltt_FixReferences"
    End Select
End Function

Also print preview would sometimes not allow the users to run a menu item to export the report to Excel or others. So you had to right click on the Previewed report to set the focus back on the report so they could then export it. This was also helped by extending the timer to five minutes.

The downside to extending the timer to five minutes was if a person stays in the same form and at the same control for considerable parts of the day, ie someone doing the same inquiries, the routine didn't realize that they had actually done something. I'd be putting in some logic sometime to reset this timer whenever they do something in the program.

Auto FE Updater   Auto FE Updater distribute new and updated Front End databases to your users with several mouse clicks.

Wrench and gear Granite Fleet Manager - the best designed fleet maintenance tracking and management system available

Comments email Tony  Search Contact Tony's Blog Privacy Policy Table of Contents

Website copyright © 1995-2013 Tony Toews