• 512-991-7197
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Always Open

Welcome to Microsoft Access Tips & Tricks

Error: Could not use file already in use


Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
 
There might be a time when you want to open database and you came across an error "could not use file [file name] file already in use" when you share the same database file after splitting it.
The error takes place because we try to open database file in Exclusive mode. 
The solution for this is simply open the file with shared mode. Below is what you should do, and this should fix your problem.
Tools->Options->Advanced. Change the default Open mode from Exclusive to Shared.

OpenDatabase Function

But if you are trying to open MS Access DB file from another MS Access file using OpenDatabase function, below code is what you need to get the error away. This is also related to the open mode.
Set gblWS = DBEngine.Workspaces(0)
Set gblExtDB = gblWS.OpenDatabase("[file name]", False, False)


The first parameter is the string of path and file name of your DB File.

The second parameter is the key to solve this problem. It is the open mode; where false is shared mode and true is exclusive mode. 

The last parameter is the ReadOnly option. Set this to false and you can write to the DB File.



Recommend other relevant articles:

 

 

© 2019 Austin Laptop [AustinLaptop.Com]. All Rights Reserved.