Close DB after idle time

Gismo

Registered User.
Local time
Today, 11:27
Joined
Jun 12, 2017
Messages
1,298
Hi,

could anyone please advise on a code to close the DB after set idle time?
 
What happens if someone is halfway through entering a record?

Have a search on here for similar threads, there have been a lot of discussions on this.
 
The problem is complex.

FIRST you need code that would support a determination of "user is idle."

SECOND, you need something like a form timer that goes off every so often to test the "user is idle" determination.

THIRD, you need a way to force any partial actions to "UNDO" whatever is going on with the form.

The timer is easier than the determination or the "forced UNDO."

I concur with Minty - search the forum.
 
What happens if someone is halfway through entering a record?

Have a search on here for similar threads, there have been a lot of discussions on this.
the form should warn that it will be shutting down
they can then override and continue
if you have set idle time to 20 min, i believe this should be enough time for someone to take action, either cancel what you are doing or continue
if not, close and loose the last entry you were working on

i am trying to prevent record locking
blocking update, as this is a live system we are working on as we are doing developments

i searched a few forums here but i am not sure where i want this to go, as you mentioned
 
I've had some thoughts emerge on this subject after years of dealing with this - and trying to implement various solutions proposed, ranging from simple to complex and mostly complex and fragile. But there is one thing we already have on the PC that might make it a lot easier.

And it's the thing that I'm definitely going to try next time I have a need to do so, FWIW:
- Task manager

Because of the fact that you can set up a Scheduled Task to run, say, every 5 minutes --but do NOT start the task unless the computer has been idle for, say, 10 minutes--that gives you an approximately (ballpark) 15 minutes of idle time.

What to do at that point? My initial thought would be create a VBScript (.vbs) file, very simple maybe 5 lines of code, which latches on to the current Access application, opens an "idle form", and in that form's startup code, there you put your logic about what you want to happen. For example, you might have a Timer on that form where after 60 seconds, if they don't press "Continue Session", it quits the application.

Haven't tried all that yet, but pretty sure it will work. Definitely my go-to next time I want to do an access idle time deal.
Recently I've had a need to set up a number of scheduled jobs on my PC, and I can confirm that setting up 1) Scheduled Task, to run 2) VBS, which run 3) an Access DB & run a named procedure.........Works fantastic. I currently have about 5, some run every 10 minutes, works perfectly. Some day my bosses will get a SQL Server and hopefully SSIS, and I can stop acting like a job server.

PS ... You might set up the scheduled task on your PC, then export it (I believe it exports as XML file? IIRC), then create some code to import it to users' PC's. Or, set up manually.

PPS ... The advantage here is that you really ARE clocking true "idle time", (because Task Manager knows what it's doing!), rather than just a form with a timer. A form with a timer is going to go off whether the user has been idle or not--which could be very annoying to the user! ("I've been typing steadily and this Idle warning goes off!")
 
Last edited:

Users who are viewing this thread

Back
Top Bottom