Jacob Hilderbrand
04-26-2007, 10:22 AM
Followup to this thread:
http://www.vbaexpress.com/forum/showthread.php?t=12440
I am using this connection string:
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & _
DBPath & ";Jet OLEDB:Database Password=" & DBPassword & ";"
Here is part of the connection code:
Dim RS As Object
Dim Conn As Object
Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = Connect
Conn.Open()
RS = CreateObject("ADODB.Recordset")
RS = Conn.Execute(StrSQL)
'
'
'
'
'
RS.Close()
Conn.Close()
RS = Nothing
Conn = Nothing
Now everything works fine, but occationnally I, or a user will get an error that the connection could not be opened because the database is opened exclusively by some other user.
I do not work with connection strings too much so I am probably just missing an option. The database should not be opened exclusively, in some cases it can be opened read only.
So my question is, how do I specify to open it read only, and how do I specify to open it in a normal mode (not exclusivily locked)?
Thanks
http://www.vbaexpress.com/forum/showthread.php?t=12440
I am using this connection string:
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & _
DBPath & ";Jet OLEDB:Database Password=" & DBPassword & ";"
Here is part of the connection code:
Dim RS As Object
Dim Conn As Object
Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = Connect
Conn.Open()
RS = CreateObject("ADODB.Recordset")
RS = Conn.Execute(StrSQL)
'
'
'
'
'
RS.Close()
Conn.Close()
RS = Nothing
Conn = Nothing
Now everything works fine, but occationnally I, or a user will get an error that the connection could not be opened because the database is opened exclusively by some other user.
I do not work with connection strings too much so I am probably just missing an option. The database should not be opened exclusively, in some cases it can be opened read only.
So my question is, how do I specify to open it read only, and how do I specify to open it in a normal mode (not exclusivily locked)?
Thanks