469,306 Members | 1,987 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Does Access provide a time-out capability?

379 256MB
I make front ends for each of my users (some of them read-only; others displaying only a subset of the data), but many of my users are pretty unsophisticated. This results in their leaving their computers on when they leave work for the day and, consequently, leaving their database open. That, of course, prevents me from working on the database's back end.

I'd prefer it if I could insert a timer that closes the front end after 15 minutes of inactivity. Failing that, does anyone know of a way to remotely kill a front end?
Oct 25 '10 #1

✓ answered by colintis

Here's an idle time example from M$

14 12372
8,800 Expert 8TB
To the best of my knowledge, there is no built-in functionality within Access that monitors inactivity. You may be able to accomplish this by the API, but I'm not exactly sure how to go about this.
Oct 25 '10 #2
32,173 Expert Mod 16PB
As long as any form is still open the timer facility can be made available to run code after a certain period of inactivity. Inactivity would have to be defined in the code though, as I don't believe Access provides anything built-in. It would mean every action within the project would have to log activity when it executed, thereby resetting any timer. Quite complicated, and prone to error unless you make sure that every possible form of detectable activity is logged.
Oct 25 '10 #3
379 256MB
Okay, then, is there a way for me to remotely kill a front end? I know that after a certain time in the evening everyone is actually off.
Oct 26 '10 #4
255 100+
Here's an idle time example from M$
Oct 26 '10 #5
8,800 Expert 8TB
The following Code comes with no Implied Warranty whatsoever, theoretically it should work.
  1. Set the Form's Timer Interval to 900000 (15 minutes), or whatever Value you like.
  2. Place the following Code in your Form's Timer() Event, I'm assuming your Form's Name is Form1.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Timer()
    2.   If Time > #11:00:00 PM# Then
    3.     DoCmd.Close acForm, "Form1", acSaveNo
    4.       DoCmd.Quit
    5.   End If
    6. End Sub
  3. Every 15 Minutes, the Timer() Event will fire and see if the Current Time is after 11:00 PM (Date is irrelevant, Time can be changed).
  4. If it is after 11:00 PM, and as long as the Database is active, and Form1 is open, the code will then:
    1. Close Form1, disregarding the Save to avoid any Prompt.
    2. Quit Access.
  5. This Procedure must be duplicated on each and every Front End.
  6. Good Luck, and let me know how it works out.
Oct 26 '10 #6
332 100+
I actually have an application that uses Colintis link. It works fine.
In another application, I also have a system table that contains two fields, param and value. One of the entry has param "IsBlocked" and the value can be either no or yes, which I can change at will. If I set it to yes, people will be kicked out of the application as soon as they perform selected operations like scrolling data or changing certain fields. If set to yes, it will also prevent people from starting the application.
Oct 26 '10 #7
379 256MB
These are great suggestions. Thanks, all! I think I'm going to first try the idle time code as published on Microsoft's website; it seems the most flexible.

I'll post back to this thread once I've figured out which approach worked best for me.
Oct 26 '10 #8
32,173 Expert Mod 16PB
I don't believe there is an Access way to kill a front-end. I expect there are ways to kill processes remotely if you have the process ID, as there are tools out there that do that, but I'm afraid I have no idea how that would be implemented programatically.

ADezii's approach of checking the time of day, may prove more productive for you considering what you've told us. In such a case, the period between checks is not limited to 15 minutes of course. Every minute would be just as appropriate (possibly more so).
Oct 26 '10 #9
32,173 Expert Mod 16PB
On first reading that I felt the concept was a little clumsy, but looking at it again, it's hard to see what type of database activity could go on if the current form and control remained the same at every check (each second) for a duration of 15 minutes.

That's quite a neat solution. Possibly not 100%, but pretty darn close. You'd probably need to ensure users only ever accessed the database via the programmed interface, but many like to ensure that anyway, so not much of a cost.
Oct 26 '10 #10
8,800 Expert 8TB
I actually downloaded the Microsoft Demo and found it to very interesting and related to this Thread. I made some slight changes of my own, prettied it up a little, and created my own Demo which I hope will clearly demonstrate the technique of closing Front End DBs after a certain period of inactivity, solely within Access. Download the Attachment and see what you think.
Attached Files
File Type: zip DetectIdleTime.zip (28.5 KB, 758 views)
Oct 26 '10 #11
379 256MB
Wow, thanks, ADezii! My work schedule this week probably means that I won't be able to actually try this out until at least the weekend, but you can be sure that I'll report back as quickly as possible.

Thanks again!
Oct 26 '10 #12
8,800 Expert 8TB
You are quite welcome, sueb.
Oct 26 '10 #13
379 256MB
Okay, this is yet another triumph! The combination of the MS stuff in the link posted by colintis and ADezii's timer are perfect--I inserted ADezii's timer bracket around the whole thing.

So how do I choose two "best" answers? Because, really, the time-of-day thing is particularly important...
Dec 28 '10 #14
8,800 Expert 8TB
colintis was the first to propose a workable solution, I do believe that you should select his as the Best Answer.
Dec 28 '10 #15

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by news.terra.es | last post: by
3 posts views Thread by Peter Moscatt | last post: by
1 post views Thread by Sebastian C. | last post: by
1 post views Thread by Jacquo Johnson | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.