Automatically Log off idle users

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewtoAccess
    New Member
    • May 2007
    • 32

    Automatically Log off idle users

    Hi,
    We have a shared Access 2000 database shared among many users within the company I work for.

    many times, users open up the shared database and forget to close it.
    So I cant even make modifications to it after work hours since users are logged in.

    Is there a way to log off users after a long period of inactivity?

    Let me know, thanks
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by NewtoAccess
    Hi,
    We have a shared Access 2000 database shared among many users within the company I work for.

    many times, users open up the shared database and forget to close it.
    So I cant even make modifications to it after work hours since users are logged in.

    Is there a way to log off users after a long period of inactivity?

    Let me know, thanks
    Yes, but there is debate on the best way to accomplish it. Here is a link to Microsoft's way:

    ACC: How to Detect User Idle Time or Inactivity
    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

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Originally posted by NewtoAccess
      Hi,
      We have a shared Access 2000 database shared among many users within the company I work for.

      many times, users open up the shared database and forget to close it.
      So I cant even make modifications to it after work hours since users are logged in.

      Is there a way to log off users after a long period of inactivity?

      Let me know, thanks
      Is there a form that will always be open? Use a global variable and public functions with the Timer, Mouse Move, and Key Press events on every form to track how long a person has been idle.

      Comment

      • NewtoAccess
        New Member
        • May 2007
        • 32

        #4
        I'll check out the website.
        I do have a Mainform that links to other forms. Mainform always remains open even if other forms are being worked on.

        I think I should put a timer on the MAINFORM. And then have countdown which alerts the user and gives them the option to reset timer or not.

        How could I code this? And where on form should it be added? 'on current' ?

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Originally posted by NewtoAccess
          I'll check out the website.
          I do have a Mainform that links to other forms. Mainform always remains open even if other forms are being worked on.

          I think I should put a timer on the MAINFORM. And then have countdown which alerts the user and gives them the option to reset timer or not.

          How could I code this? And where on form should it be added? 'on current' ?
          The link provides you with everything you need to implement one way of checking to see if someone's idle.Let us know if you have any touble.

          Comment

          • NewtoAccess
            New Member
            • May 2007
            • 32

            #6
            Thanks for the link. I added the forms as mentioned on the microsoft site, only problem is an option whether or not to continue working did not appear.
            It just closed right away.

            I want to give the user a warning before closing by checking yes/no. if nothing is selected then it should proceed with quiting app.

            Comment

            • NewtoAccess
              New Member
              • May 2007
              • 32

              #7
              This is what i have so far for sub routine action:

              Sub IdleTimeDetecte d(ExpiredMinute s)
              Dim Msg As String
              strMsg = ""
              strMsg = strMsg & "Applicatio n will CLOSE_"
              strMsg = strMsg & "Click YES to continue working. Click NO to exit"
              If MsgBox(strMsg, vbQuestion + vbYesNo, "No Activity detected") = vbYes Then
              DoCmd.DoMenuIte m acFormBar, acRecordsMenu, 5, , acMenuVer70
              Else
              Application.Qui t A_SAVE
              delayTimer = 10000
              Application.Qui t A_SAVE
              End If

              MsgBox Msg, 48
              End Sub

              Comment

              • puppydogbuddy
                Recognized Expert Top Contributor
                • May 2007
                • 1923

                #8
                Originally posted by NewtoAccess
                This is what i have so far for sub routine action:

                Sub IdleTimeDetecte d(ExpiredMinute s)
                Dim Msg As String
                strMsg = ""
                strMsg = strMsg & "Applicatio n will CLOSE_"
                strMsg = strMsg & "Click YES to continue working. Click NO to exit"
                If MsgBox(strMsg, vbQuestion + vbYesNo, "No Activity detected") = vbYes Then
                DoCmd.DoMenuIte m acFormBar, acRecordsMenu, 5, , acMenuVer70
                Else
                Application.Qui t A_SAVE
                delayTimer = 10000
                Application.Qui t A_SAVE
                End If

                MsgBox Msg, 48
                End Sub

                Change this:
                Code:
                           Else
                               Application.Quit A_SAVE
                        delayTimer = 10000
                        Application.Quit A_SAVE
                            End If
                To this:
                Code:
                           Else
                      Application.Quit acSaveYes
                       delayTimer = 10000
                       End If
                You copied "Application.Qu it A_SAVE" from Access 2.0 code. Access 2.0 is not Access 2000, rather it is the version that existed pre97.

                Comment

                • NewtoAccess
                  New Member
                  • May 2007
                  • 32

                  #9
                  OK. I'll update the commands.
                  Still though, I want application to autoclose.

                  So if VBYesNo no button selected within 10 seconds, then I want app to proceed with closing anyway.

                  How can this be accomplished?

                  Comment

                  • puppydogbuddy
                    Recognized Expert Top Contributor
                    • May 2007
                    • 1923

                    #10
                    Originally posted by NewtoAccess
                    OK. I'll update the commands.
                    Still though, I want application to autoclose.

                    So if VBYesNo no button selected within 10 seconds, then I want app to proceed with closing anyway.

                    How can this be accomplished?
                    You did not post all of your code, so you may need to replace object names in the code below with the appropriate object names from your code.
                    Code:
                    Else
                           idleTime = 0                          'reset counters 
                           delayTimer = 10000
                           Do Until idleTime = 10000
                                 'Hang loose
                                 idleTime = idleTime + ElapsedTime
                                 If idleTime = 10000 Then
                                    Exit Do
                                 End If
                           Loop
                           delayTimer = 0
                           Application.Quit acSaveYes
                    End If

                    Comment

                    • FishVal
                      Recognized Expert Specialist
                      • Jun 2007
                      • 2656

                      #11
                      Originally posted by NewtoAccess
                      OK. I'll update the commands.
                      Still though, I want application to autoclose.

                      So if VBYesNo no button selected within 10 seconds, then I want app to proceed with closing anyway.

                      How can this be accomplished?
                      It cannot be accomplished in any way with msgbox.
                      While msgbox is active no events will be triggered in any form.

                      You should create your own form with warning message, Yes No buttons and timer.

                      Good Luck.

                      Comment

                      • Proaccesspro
                        New Member
                        • Apr 2007
                        • 132

                        #12
                        Originally posted by puppydogbuddy
                        Yes, but there is debate on the best way to accomplish it. Here is a link to Microsoft's way:

                        ACC: How to Detect User Idle Time or Inactivity
                        http://support.microsoft.com/?id=128814

                        Not sure where to place this code: (From MS' support page)

                        4. Create the following procedure in the form module: (How to access the FORM MODULE?)

                        Sub IdleTimeDetecte d (ExpiredMinutes )
                        Dim Msg As String
                        Msg = "No user activity detected in the last "
                        Msg = Msg & ExpiredMinutes & " minute(s)!"
                        MsgBox Msg, 48
                        End Sub

                        Comment

                        • puppydogbuddy
                          Recognized Expert Top Contributor
                          • May 2007
                          • 1923

                          #13
                          Originally posted by FishVal
                          It cannot be accomplished in any way with msgbox.
                          While msgbox is active no events will be triggered in any form.

                          You should create your own form with warning message, Yes No buttons and timer.

                          Good Luck.
                          FishVal,
                          If I understood correctly NewtoAccess wants the system administrator to have the last say before shutdown.. NewtoAccess requested (see below) a "no" response to trigger the application exit 10 seconds after it is clicked, which is what the above code does.

                          <<<<<<So if VBYesNo no button selected within 10 seconds, then I want app to proceed with closing anyway.>>>>>>

                          Comment

                          • puppydogbuddy
                            Recognized Expert Top Contributor
                            • May 2007
                            • 1923

                            #14
                            NewtoAccess,
                            the Form module simply means the code behind a form (e.g. your idleTimeDected form) as opposed to a standard module or macro. You need to decide how you want the code to work before proceeding.

                            Comment

                            • FishVal
                              Recognized Expert Specialist
                              • Jun 2007
                              • 2656

                              #15
                              Originally posted by puppydogbuddy
                              FishVal,
                              If I understood correctly NewtoAccess wants the system administrator to have the last say before shutdown.. NewtoAccess requested (see below) a "no" response to trigger the application exit 10 seconds after it is clicked, which is what the above code does.

                              <<<<<<So if VBYesNo no button selected within 10 seconds, then I want app to proceed with closing anyway.>>>>>>
                              I'm curious whether you've tested the code.
                              I've checked that while MsgBox is active no Timer event will be triggered, no code will run asynchronously.
                              No such a problem with special form. In this case there are two opportunities:
                              1) to handle timer event from this warning form
                              2) to handle timer event from the IdleUser detecting form (somewhat more sophisticated)
                              Good luck.

                              Comment

                              Working...