I have a password protected MDB. Which properties I have to set up, and how, in an ADO Connection to access it?
Thanks in advance.
Printable View
I have a password protected MDB. Which properties I have to set up, and how, in an ADO Connection to access it?
Thanks in advance.
Hi,
Iam just going thru some books on that topic for my necessity and i read books saying that
"Unfortunately there is no way to set,change,or clear a database password by using ADO code.But you can do the same with DAO"
maybe this will help a bit, note the nice little problem with in the .Properties string:
[Edited by Sascha on 11-10-2000 at 05:33 PM]Code:
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Test", GetConn(App.Path & "\test.mdb", "test"), adOpenStatic, adLockOptimistic
Set Grid.DataSource = rs
Set rs = Nothing
End Sub
Private Function GetConn(ByRef Path As String, _
ByRef Pwd As String) As ADODB.Connection
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Jet.OLEDB.3.51"
.Properties("Jet OLEDB:Database Password") = Pwd
.Open Path
End With
Set GetConn = cn
Set cn = Nothing
End Function
Check the "Disable smilies in this post" box when posting a message.
JMuller - I hate to say it, but Access DBs have probably the worst security in the world :(.