Access 2007 dabase locked Can't rename or delete the laccdb file

Answered Access 2007 dabase locked Can't rename or delete the laccdb file

  • Monday, March 12, 2012 9:56 PM
     
     

    Hi all

    I have a application that work with to files. One with VBA code another with tables.

    The first with code it's in the drive C: for each workstation.

    The one with tables it's in share drive in our Win7 network.

    My problem is that one of the users somehow left the database opened... I Know the workstation ID via OpenSchema from the ADO connection.

    And now I can't rename or delete the laccdb file...

    Pheraps this is more a operating system issue...

    Any help / hints will be appreciate

    Joao

All Replies

  • Monday, March 12, 2012 10:05 PM
     
     Answered

    If you have a Network Administrator, contact this person to Remotely log off the User on that particular Workstation ID.

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"

    Please vote an answer helpful if they helped. Please mark an answer as an answer when your question is being answered.

    • Proposed As Answer by KCDW Monday, March 12, 2012 10:20 PM
    • Marked As Answer by Bruce SongModerator Wednesday, April 04, 2012 4:00 AM
    •  
  • Monday, March 12, 2012 10:20 PM
     
     Answered Has Code

    You may want to design a detect Idle time shut down to prevent this.

    Daniel helped me design mine. Take a look.

    Create a form called DetectIdleTime.

    List it in your AutoExec Macro to open hidden.

    Set the Timer Interval to a good number (I use 60000) it is measured in milli-seconds.

    Create an Event in the On Timer.

    Enter code in the forms Module

    Private Sub Form_Timer()
             Const IDLEMINUTES = 60
    
             Static PrevControlName As String
             Static PrevFormName As String
             Static ExpiredTime
    
             Dim ActiveFormName As String
             Dim ActiveControlName As String
             Dim ExpiredMinutes
    
             On Error Resume Next
    
             ActiveFormName = Screen.ActiveForm.Name
             If Err Then
                ActiveFormName = "No Active Form"
                Err = 0
             End If
    
             ActiveControlName = Screen.ActiveControl.Name
                If Err Then
                ActiveControlName = "No Active Control"
                Err = 0
             End If
    
             If (PrevControlName = "") Or (PrevFormName = "") _
               Or (ActiveFormName <> PrevFormName) _
               Or (ActiveControlName <> PrevControlName) Then
                PrevControlName = ActiveControlName
                PrevFormName = ActiveFormName
                ExpiredTime = 0
             Else
                ExpiredTime = ExpiredTime + Me.TimerInterval
             End If
    
             ExpiredMinutes = (ExpiredTime / 1000) / 60
             If ExpiredMinutes >= IDLEMINUTES Then
                ExpiredTime = 0
                IdleTimeDetected ExpiredMinutes
             End If
    
    End Sub
    


    Sub IdleTimeDetected(ExpiredMinutes)
       With Screen.ActiveForm
          If Screen.ActiveForm.Dirty = True Then
          .Undo
          End If
          End With
       Application.Quit
    End Sub
    
    

    You may have to make some adjustments.

    The first thing I tried was a simple OnTimer event (about 1 hour) to quit but this is much better.

    Thanks again to Daniel (& Dirk Goldgar) for helping me with this.

    Hope this helps and good luck.


    Chris Ward