Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    121

    Unanswered: Code to "boot" users out of a Access Program

    All,
    I know this code has been passed around, I just have a small problem with it. This is supposed to kick out users of a program that is used by many, so you can perform maintenance to it. Everything is working on it, only it is not opening the "frmAppShutDownWarn" to warn the user it is about to be shut down. Is there something I am missing here?
    ================================================== =======

    Private Sub Form_Timer()
    'This will allow the programmer to "boot" someone out of the program manually.

    Dim strFileName As String


    strFileName = Dir("G:\Share\Shipping\Shipping Clerical\BOL Release Program\Archive\shutdown.ozx")

    If boolCountDown = False Then
    ' Do nothing unless the check file is missing.
    If strFileName <> "shutdown.ozx" Then
    ' The check file is not found so
    ' set the count down variable to true and
    ' number of minutes until this session
    ' of Access will be shut down.
    boolCountDown = True
    intCountDownMinutes = 2
    End If
    Else
    ' Count down variable is true so warn
    ' the user that the application will be shut down
    ' in X number of minutes. The number of minutes
    ' will be 1 less than the initial value of the
    ' intCountDownMinutes variable because the form timer
    ' event is set to fire every 60 seconds
    intCountDownMinutes = intCountDownMinutes - 1
    DoCmd.OpenForm "frmAppShutDownWarn"
    Forms!frmAppShutDownWarn!txtWarning = "This application will be shut down in approximately " & intCountDownMinutes & " minute(s). Please save all work."
    If intCountDownMinutes < 1 Then
    ' Shut down Access if the countdown is zero,
    ' saving all work by default.
    Application.Quit acQuitSaveAll
    End If
    End If

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what did the site you got the code from suggest?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2007
    Posts
    277
    Have you put in a breakpoint to see if the code is actually executing?
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  4. #4
    Join Date
    Nov 2008
    Posts
    4
    Do you have the form "frmAppShutDownWarn" in your application? Also try from the visual basic editor Tools->Options->General and set Error Trapping to 'break on all errors', this way you can see if there is an error when trying to open the form.

Posting Permissions

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