Read-only mode is a modified form of shared mode. When you open a database in read-only mode, you cannot change objects in the database — data and structural information included. This mode, however, does not prevent other users from changing data and should not be confused with opening the file in read-only mode from an operating system level. To open a database in read-only mode, set the read-only argument of the OpenDatabase method to True. You could modify the previous example to open the database in exclusive, read-only mode by changing the arguments of the OpenDatabase method as follows. In these examples, strDbPath
is the path to the database:
Set dbs = OpenDatabase(strDbPath, True, True)
To open a database in shared, read-only mode, use the following code:
Set dbs = OpenDatabase(strDbPath, False, True)
Note Opening a database in read-only mode does not prevent shared table-type locks or read locks; therefore, opening a database in read-only mode does not prevent locking conflicts.