On Thu, 04 Sep 2003 17:51:50 -0400 in comp.databases.ms-access,
AlanFern <al**@amfern.co.uk> wrote:
I use a Access database with front ends on each PC and the back end with
the data on a main server. A number of the PC's keep leaving forms
open displaying data. This causes problems if another user wants to
access the record they have open. Is there a way to put some sort of
timer on the form so if it is left idle for a period of time then it
would automaticly close down.
Set form's KeyPreview = yes.
(declarations section)
Private mlngTimeout as Long
(Assuming Timer interval set to 1000)
Sub Form_Timer()
mlngTimeout=mlngTimeout + 1
if mlngTimeout > 60*5 Then ' 5 minutes
Me.Undo
Docmd.Close acForm, Me.Name
End Sub
End Sub
Sub Form_MouseMove()
mlngTimeout = 0
End Sub
Sub Form_KeyUp()
mlngTimeout = 0
End Sub
--
A)bort, R)etry, I)nfluence with large hammer.
(replace sithlord with trevor for email)