Forum Discussion

RH1221's avatar
RH1221
Regular Visitor
3 months ago
Solved

Power BI Desktop: Intermittent error “'' is already in use and cannot be used” during refresh

I am a Japanese user and a non-native English speaker, so please excuse any awkward wording. I will include the original Japanese description below for reference.   I am using Power BI Desktop and...
  • Shai_Karmani's avatar
    3 months ago

    That error comes from the Access (Jet/ACE) driver, not from Power BI itself. When you open the .mdb through Access.Database, the driver creates an .ldb lock file next to it. If the production system writes to the same .mdb at the moment Power Query tries to acquire the lock, the driver returns "'' is already in use and cannot be used." with an empty pair of quotes, which matches your symptom exactly. The roughly 1 in 5 failure rate also fits, since it only fails when the writer happens to be holding the lock at refresh time.

    Power Query has no built-in retry on that lock. The cleanest workaround is to remove the contention by reading from a local copy. Schedule a small task (PowerShell or robocopy) to copy file.mdb from the UNC path to a local folder right before each refresh, then point your Source step at the local copy:

    Source = Access.Database(File.Contents("C:\PowerBI\stage\file.mdb"), [CreateNavigationProperties = true])

    That decouples Power BI from the live writer entirely. If staging is not feasible, the next best option is to migrate the data into SQL Server or another concurrent read backend and connect Power BI there.

    If it solved your issue, please mark it as the accepted solution and give it a kudos.

    Best regards,
    Shai Karmani

  • v-veshwara-msft's avatar
    3 months ago

    Hi RH1221 ,

    Thanks for reaching out to Microsoft Fabric Community.

    To add to the discussion here,

    Since you were specifically looking for a Power Query side workaround without modifying the source system itself, there are a couple of things worth testing before moving to a local staging approach.

    First, try wrapping File.Contents with Binary.Buffer in the Source step:

    Source =
        Access.Database(
            Binary.Buffer(
                File.Contents("\\192.168.xx.xx\folder\file.mdb")
            ),
            [CreateNavigationProperties = true]
        )

    This forces Power Query to read the MDB into memory in a single operation and release the file handle sooner, which can help reduce the lock contention window during refresh.

     

    Another thing worth trying is disabling parallel table loading:

    Options -> Current File -> Data Load -> uncheck "Enable parallel loading of tables"

    By default, Power BI can open multiple connection handles simultaneously during refresh, and when several queries hit the same MDB at the same time, it may trigger this intermittent locking issue.

     

    An additional option you could test is switching from the OLEDB provider to the ODBC driver. The ODBC connection tends to handle MDB lock file cleanup more cleanly, and this has helped improve stability with intermittent locking issues in similar scenarios. So that may be worth trying if the above changes only partially reduce the failures.

     

    For reference:
    Access error "Could not use ; file already in use. (Error 3045)" - Microsoft Q&A
    Solved: Not able to connect to MS Access DB as a Source in... - Microsoft Fabric Community

    Binary.Buffer - PowerQuery M | Microsoft Learn

     

    That said, I do agree with the earlier suggestion by  Shai_Karmani that the most reliable long term solution is staging the MDB locally or otherwise separating Power BI refreshes from the application's active write cycle. The Binary.Buffer approach can reduce the likelihood of collision, but it cannot fully avoid failures if the source system holds an exclusive lock at refresh time.

     

    Hope this helps. Please reach out for further assistance.
    Thank you.