Idle Detect/Inactivity Timeout Tips page

I just created a tips page on Idle Detect/Inactivity Timeout.   Microsoft’s KB article on this topic is decent but doesn’t cover some of the real world issues we found.

I also needed this page to be referenced by some new functionality in the about to be announced Enterprise Edition version of the Auto FE Updater.   The sample code I introduced a while back in the Auto FE Updater but stated it was for future use .  The code is the AutoFEUpdater_ExitApp subroutine in the module zmdlAutoFEUpdater.   The idea being that your app will automatically exit the app after 30 or 60 minutes of inactivity and this will be logged in Auto FE Updater.  This way, you the developer, can see who hasn’t exited the app at the end of the day.   Or if the app was terminated abnormally because of either Access or the operating system crashing, power failure or other abnormal condition.

I have no idea now where I found the code for the IsMDE function.   If someone would like to tell me an original URL and a source I’d be happy to acknowledge them.

3 thoughts on “Idle Detect/Inactivity Timeout Tips page”

  1. I don’t think the IsMDE code is well-written. For one, it initializes the database variable with CurrentDB, and then attempts to close the database, which you cannot do. No harm, no foul, but it’s sloppy code.

    My other criticism is more one of style, and that’s that it explicitly sets the return of False. This is redundant — a function with return type Boolean will not return True except if you explicitly return true. Thus, IsMDE = False in the error handler is another piece of redundant code.

    Last of all, I see no purpose whatsoever in the On Error GoTo 0, which is there just before Exit Function. Since when has it been necessary to turn off the error handler upon exit of a subroutine/function? There is not one piece of sample VBA code from Microsoft that suggest this is necessary, nor is there any evidence I’ve seen anywhere that suggests that an On Error directive that is set to point to a label local within a sub/function can do anything but go out of scope upon termination of the sub/function.

    And finally (that’s what comes after “last of all”, right next to my third hand), does it work for ACCDE as well as MDE? Might be good to document that somewhere if it does (or even more important, if it doesn’t).

  2. Hi David,

    I’ve found rare instances where NOT turning off error trapping at the end of a routine leads to a real debugging headache. From my page “Tips: How to fix mysterious errors” at

    h. Check that your functions and subroutines end with “On Error Goto 0″

    It’s a good idea to reset error handling when you leave a function or subroutine, as an error in one routine can sometimes, in rare occasions, be trapped and reported by another routine. This can be quite confusing, to say the least. Resetting error handling with “On Error Goto 0″ as the last statement in your routine will prevent this kind of confusion from occurring.

  3. Tony,

    We use some similar code in our Inactive Shut Down Control free tool at

    Here are some of the issues we discovered:

    1. Forms that prompted for user input when they close. These forms, and the application itself cannot be closed automatically. We created a global variable to indicate that an inactive timeout had occured, then the developer needs to incorporate this variable into the form OnClose logic so that the user input prompt does not appear when the application times out.

    2. It is useful to have a warning message appear before the application shuts down, thereby giving the user the opportunity to cancel the automatic shut down.

    3. The above should pop up on top of any other application that is running on the user’s desktop.

    4. I like to use a 3 hour inactivity timeout. This gives the user a chance to leave the applicaiton open while taking a long lunch, but when leaving for the day at @5pm means all applications will likely be shut down by 8pm. Anyway I usually schedule night-time procedures and backups for around 3am anyway.


    Peter De Baets

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>