Does Access provide a time-out capability?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sueb
    Contributor
    • Apr 2010
    • 379

    Does Access provide a time-out capability?

    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?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    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.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32653

      #3
      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.

      Comment

      • sueb
        Contributor
        • Apr 2010
        • 379

        #4
        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.

        Comment

        • colintis
          Contributor
          • Mar 2010
          • 255

          #5
          Here's an idle time example from M$
          Microsoft Support is here to help you with Microsoft products. Find how-to articles, videos, and training for Microsoft Copilot, Microsoft 365, Windows 11, Surface, and more.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            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.
              Code:
              Private Sub Form_Timer()
                If Time > #11:00:00 PM# Then
                  DoCmd.Close acForm, "Form1", acSaveNo
                    DoCmd.Quit
                End If
              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.

            Comment

            • Mariostg
              Contributor
              • Sep 2010
              • 332

              #7
              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.

              Comment

              • sueb
                Contributor
                • Apr 2010
                • 379

                #8
                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.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32653

                  #9
                  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).

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32653

                    #10
                    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.

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #11
                      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

                      Comment

                      • sueb
                        Contributor
                        • Apr 2010
                        • 379

                        #12
                        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!

                        Comment

                        • ADezii
                          Recognized Expert Expert
                          • Apr 2006
                          • 8834

                          #13
                          You are quite welcome, sueb.

                          Comment

                          • sueb
                            Contributor
                            • Apr 2010
                            • 379

                            #14
                            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...

                            Comment

                            • ADezii
                              Recognized Expert Expert
                              • Apr 2006
                              • 8834

                              #15
                              colintis was the first to propose a workable solution, I do believe that you should select his as the Best Answer.

                              Comment

                              Working...