none
"You can not use BA.accdb. The file is already in use" RRS feed

  • Question

  • Hi

    There must be something with one of my Access databases. Question is what?

    When i try to use the query wizard I get this message "You can not use BA.accdb. The file is already in use""

    If I open a new database and does the same, the wizard works.

    So.... whats the news in my BA.accdb"?

    Its a Timer Event. I turned that off. But still get "You can not use BA.accdb. The file is already in use"

    Any ideas what this might come from?


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00

    Tuesday, March 1, 2016 3:41 PM

Answers

All replies

  • Hi Peter. Is the name of your database file "BA.accdb?" If so, have you tried opening it without the code enabled and then try to use the Wizard again? Just a thought...
    Tuesday, March 1, 2016 4:10 PM
  • When i try to use the query wizard I get this message "You can not use BA.accdb. The file is already in use""

    Hi Peter,

    You could try: close the database, and see with Task Manager if there is still an Access process running. If yes, stop that process.

    Imb.

    Tuesday, March 1, 2016 4:11 PM
  • Hi DB

    I have now tried to open the database "BA.accdb". I bypassed start up options by holding. down the SHIFT key while opening my database.

    And yes now the Wizard works.

    When starting "BA.accdb" again in "normal" mode. The Wizards is not working.

    There are three Forms opening at start, by excluding them one by one I found the form causing Wizards not to work and it is the form "Produktion".

    Produktion has an OnOpen property.

    Private Sub Form_Open(Cancel As Integer)
    OpenAllDatabases True
    End Sub

    The "OpenAllDatabases" is a code I found and use to improve performance with linked tables.
    OpenAllDatabases

    In my case the code is like this:

    Option Compare Database
    Option Explicit
    
    Sub OpenAllDatabases(pfInit As Boolean)
      ' Open a handle to all databases and keep it open during the entire time the application runs.
      ' Params  : pfInit   TRUE to initialize (call when application starts)
      '                    FALSE to close (call when application ends)
      ' Source and Thanks to: Luke Chung FMS https://www.fmsinc.com/microsoftaccess/Performance/LinkedDatabase.html
        
      Dim X As Integer
      Dim strName As String
      Dim strMsg As String
     
      ' Maxantal tabelldatabaser på servern som skall länkas
      ' när detta skrivs är det Trading Base.accdb
      Const cintMaxDatabases As Integer = 1
    
      ' List of databases kept in a static array so we can close them later
      Static dbsOpen() As DAO.Database
     
      If pfInit Then
      ' Om kunden har valt att inte jobba med Trading Base i nätverk och låter bli att definiera sökväg
      If (Eval("[Forms]![Alla Val]![EgenPathExtra1] Is Null")) Then Exit Sub
        ReDim dbsOpen(1 To cintMaxDatabases)
        For X = 1 To cintMaxDatabases
          Select Case X
            Case 1:
              ' för att detta skall fungera ... gå till fliken Bas / Mappar mm och skriv in sökvägen till Trading Base
              strName = [Forms]![Alla Val]![EgenPathExtra1] & "Trading Base.accdb"
                  End Select
          strMsg = ""
    
          On Error Resume Next
          Set dbsOpen(X) = OpenDatabase(strName)
          If Err.Number > 0 Then
            strMsg = "Trouble opening database: " & strName & vbCrLf & _
                     "Make sure the drive is available. (du anger sökvägen under Bas / Mappar mm" & vbCrLf & _
                     "Error: " & Err.Description & " (" & Err.Number & ")"
          End If
    
          On Error GoTo 0
          If strMsg <> "" Then
            MsgBox strMsg
            Exit For
          End If
        Next X
      Else
        On Error Resume Next
        For X = 1 To cintMaxDatabases
          dbsOpen(X).Close
        Next X
      End If
    End Sub

    In the "mid" of the code above I have an If:

     If (Eval("[Forms]![Alla Val]![EgenPathExtra1] Is Null")) Then Exit Sub

    So if the user dont register the path to the BE "Trading Base.accdb" this If code exit the Sub OpenAllDatabases.

    And that makes the wizards run. So there is something in the code below that If making Wizards not to run and even stopping the possibility to convert macros to code.

    But what? I dont know. Any ideas?


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00




    Wednesday, March 2, 2016 5:31 AM
  • Hi Imb

    Did as you wrote.

    But there is no Access process running as I can see-


    Best // Peter Forss Stockholm and Sigtuna GMT +1.00

    Wednesday, March 2, 2016 5:32 AM
  • Hi Peter. Have you tried stepping through the code to see if it's doing exactly what you're expecting? Just a thought...
    Wednesday, March 2, 2016 4:06 PM
  • But there is no Access process running as I can see-

    Hi Peter,

    With Windows10, check not only the Applications, but also the Backgroundprocesses.

    Imb.


    Edit: I do not think this is the case either, that would result in a different message.
    • Edited by Imb-hb Wednesday, March 2, 2016 5:00 PM edit added
    Wednesday, March 2, 2016 4:27 PM
  • Hi Peter,

    To find which process is using the Access file we can use Process Explorer to search the file we want to look for. More detail you can refer to the thread below:

    how to find which process locked the log file

    And here is the link for downloading the Process Explorer:

    Process Explorer v16.12

    Hope it is helpful.

    Regards & Fei



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, March 3, 2016 3:22 AM
    Moderator