Microsoft has the following which should also work with Access 97.
Detect User Idle Time or Inactivity in Access 2000
Check
http://support.microsoft.com/kb/210297
================================================
AND a long while back John Viescas posted this:
John Viescas, author
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
I've used a variation of this technique in a couple of applications. First,
define a Public integer variable (I called mine gintActive). Define a form
that opens Hidden in your Startup and put a 5 minute value (300000) in the
Timer property. Behind the form, put this code:
Private Sub Form_GotFocus()
' This form should NEVER get the focus
' Hide it if it does!
' First, try to put focus elsewhere
On Error Resume Next
Forms!frmMain.SetFocus '<= name of main "menu" form
DoEvents
' Then hide me
Me.Visible = False
End Sub
Private Sub Form_Timer()
' This routine fires every 5 minutes
' and updates Public variable gintActive
' When gintActive exceeds 24 (2 hours),
' this routine will warn and close the application.
' gintActive is set to zero in all form current events.
gintActive = gintActive + 1
If gintActive > 24 Then
gintActive = 0
' Open form with short timer warning of shutdown
' fdlgWarning does Application.Quit in 10 minutes
DoCmd.OpenForm "fdlgWarning"
End If
End Sub
In *EVERY* other form in your application, add this line in the form Current
event:
gintActive = 0 ' Reset the timeout
============================================================================
============================================================================
The following KnowledgeBase artice should get you started:
http://support.microsoft.com/default.aspx?scid=kb;en-us;210297
HOW TO: Detect User Idle Time or Inactivity in Access 2000
============================================================================
============================================================================
I got this code from rolf.gerlicher(at)gmx.de
You call IdleTime() and get the duration in tick from the last time the
Keyboard was pressed or mouse was moved.
I think
http://support.microsoft.com/default.aspx?scid=kb;en-us;210297, if
Ms Access is not active application and user is working with another
application, it will consider idle time. Depend on your need, you can use one
of these two idle detection methods.
Private Type PLASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private m_typPLII As PLASTINPUTINFO
Private Declare Function GetTickCount Lib "kernel32" () As Long
Public Function IdleTime() As Long
On Error GoTo IdleTime_ErrHandler
m_typPLII.dwTime = 0
m_typPLII.cbSize = Len(m_typPLII)
GetLastInputInfo m_typPLII
IdleTime = GetTickCount() - m_typPLII.dwTime
IdleTime_NormalExit:
Exit Function
IdleTime_ErrHandler:
MsgBox Err.Description & ". Error number = " & Err.Number & ". Error is in
IdleTime."
Resume IdleTime_NormalExit
End Function
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County