stop watch

J

Jeff

I have seen some of the traffic back and forth on this
subject, still unsure how to affect the following:

A hidden form tracks how long since the user has
interacted with the database. When the time elapsed
equals five minutes, the session terminates.

Any guidance to the right path is greatly appreciated.

On form open, timer = 0
On database activity, timer reset to 0

Timerinterval = 1000
Timer = Timer + Timerinterval

When Timerinterval = 300000, docmd.quit
 
M

Michel Walsh

Hi,

Not exactly how I would do it. Leave the timerinterval to 1000 ( one
second ). Have a global variable, for the form, in the declaration section

Option Compare Database
Option Explicit
Private LastActivity As Date


and set it to Now if there is activity (keyDown event of form, if the
form has its KeyPreview set to true):


LastActivity = Now( )



Next, in the onTimer event of the form, test if the difference in
seconds exceed 300 between Now and LastActivity, you can "leave" (or undo
the form then leave), if that is so:


If 300<= DateDiff("s", LastActivity, Now() ) then
Me.Undo
Application.Quit
End If


Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

=SetTimer() 5
Idle user detect form 5
Clock or operator error? 2
VBA HELP!!! 1
Timers and code... 1
VBA HELP PLEASE!!! 1
VBA HELP PLEASE!!!! 2
**VBA Code Help Please!!!** 1

Top