A quick question for database experts. See the following code (VBA / ADO) called from Excel:
Dim DBPath As String, ConnStr As String
DBPath = ThisWorkbook.Path & Application.PathSeparator & "Database.mdb"
ConnStr = "Data Source=" & DBPath & ";" & "Jet OLEDB:Database Password=" & DBPass()
Dim cnn as ADODB.Connection
Set cnn = New ADODB.Connection
With cnn
.Provider = CheckProvider(strPath:=DBPath) ' Separate function call. Ignore
.Mode = adModeRead
.Open ConnStr
End With
Stop ' To inspect the directory...
It should open a read-only database, given the adModeRead specification. However, I noticed that the lock file (Database.ldb) is still being created / deleted in the directory while the connection is active. Of course, this contradicts the read-only command, which should mean that no data can be written, and therefore file locking is not required.
Can anyone explain what is going on here? Thanks.
Edit: and continued - if I wanted to open the connection as read-only clean without creating a lock file, is there another method?