Results 1 to 8 of 8
  1. #1
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Force Disconnect (97 / 2000)

    In a recent post about forcibly disconnecting a user, a suggestion was made that you could use a form timer to detect inactivity and forcibly disconnect a user. I am wondering whether/how people make that work.
    What do you test for to detect inacivity? Do you attach the timer to each form or just the main menu?
    I just checked Help in access 97 and it gave 65,535 millisecs as the highest value for the timer event. This is just over a minute, so how do you allow users to be inactive for longer periods of time?
    Regards
    John



  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Force Disconnect (97 / 2000)

    First of all, you can actually put a value higher than 65,535 in timer interval. It is a long integer, so you can make it a big number.

    I'd have a single hidden form, with the timer interval set so it would fire perhaps every 5 minutes. The timer event would be something like this:

    Static LastControlName as string
    On Error Goto Error_Handler
    If Screen.ActiveControl.name = LastControlName then
    '
    ' put your exit code here.
    '
    Else
    LastControlName = Screen.ActiveControl.name
    End If

    Exit_Here:
    Exit sub
    Error_Handler:
    Resume Exit_Here
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Force Disconnect (97 / 2000)

    In 97 and 2000 help:
    <hr>The TimerInterval property setting is a Long Integer value between 0 and 2,147,483,647.<hr>
    I think the lower limit may have been in Access 2 because I remember it as well.
    Charlotte

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Force Disconnect (97 / 2000)

    It was Access 2 Charlotte, I remember it as well.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Force Disconnect (97 / 2000)

    Thanks for those suggestions. Both Access 97 and 2000 still have 65535 in one place , and the higher figure in another. That is a much more useful number.

    Forcing exit like this still seems problematic to me. Likely to create problems. For instance your sample code would force an exit if the same control happened to have the focus now as at the previous time, no matter how much activity had been going on. If this happened to you a year after you set it up, it would be hard to remember and track down what was going on.
    You could also get problems with partially completed actions, like incomplete records that would all need to be handled. I imagine it would take a while to get it to work reliably, so I would only use this if it was really important.
    Regards
    John



  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Force Disconnect (97 / 2000)

    You could also save the value of the control, and use that as a 2nd check; that is, terminate if same control and same value.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Disconnect (97 / 2000)

    Attached is my version of booting inactive users. It is based on 2 minutes of "No Keystroke and/or No Mouse Movement".
    A 'Countdown form' allows the user to stop the process.
    You can tweak the timing - I used 2 minutes just for your viewing. I set mine to 10 minutes.

    This is in Access 97 but can probably be updated to newer editions.

    Michael Abrams
    Attached Files Attached Files

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Force Disconnect (97 / 2000)

    Thanks for that.
    For those that haven't downloaded and looked at Michael's file, it involves a public variable keeping track of the time since the last keystroke or mouse down event. When this time reaches some value, it then warns the user they are about to be kicked off. It requires each form to have a keydown event that resets the timer to zero, and each section of each form to have a mouse down event to do the same. So there is a fair bit of work setting it up.
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •