I've attached a sample database (Access 2000 format) that uses Windows Message hooks to capture keyboard/mouse activity to the database. Opening the database will open a form in which the User can type some miscellaneous text, but if the computer remains idle (no keyboard or mouse activity) or if the Windows has the focus on another application, the database will close and Access will exit after ten seconds.
You can use different timeout values by simply changing the value of the timeout constant in this line of the mdlTimer Module:
Private Const lTimerMax As Long = 10
This seems to be an amazing code. Unfortunately I am using Windows 10 (64bit) in MS Access 2016. I would appreciate if this code can be converted to support my version.