Opening a MS Access database from VB that is being used by another user
database, ms-access, vb6
Solution
Try:
Set BaseDB = OpenDatabase("gui_db.mdb", false)
To open the database in shared mode. Note that all clients must open the database in shared mode.
Problem
Is there a way to open a MS Access database from VB 6.0 that is being used by another user. I have a service that is updating a .mdb file. I want to monitor this DB by reading some parameters from it periodically. If I try to simply open the DB (which works if the DB is not used) like this: ``` Private Sub Form_Load() Dim CurrentDBFileName On Error GoTo ErrorHandler Set BaseDB = OpenDatabase("c:\temp\log_db.mdb") Set DestRS = BaseDB.OpenRecordset("current_log_info", dbOpenDynaset) DestRS.MoveFirst CurrentDBFileName = DestRS!CurrentDB BaseDB.Close ErrorHandler: Debug.Print Err.Number; Err.Description End Sub ``` The error I get: 3051 The Microsoft Jet database engine cannot open the file 'b:\log_db.mdb'. It is already opened exclusively by another user, or you need permission to view its data. How can I get around this? I can not change the service updating the MDB file since it is not mine.