How to open a password protected access database using ADO
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 'Database - How to open a password protected access database using ADO Option Explicit Dim cn As New ADODB.Connection, strCNString As String Private Sub OpenDB_Method1() cn.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & App.Path & "\Bibile.mdb" & _ ";Jet " & "OLEDB:Database Password=TestPass" MsgBox "Data File is now opened" cn.Close End Sub Private Sub OpenDB_Method2() strCNString = "Data Source=" & App.Path & "\Bibile.mdb" cn.Provider = "Microsoft Jet 4.0 OLE DB Provider" cn.ConnectionString = strCNString cn.Properties("Jet OLEDB:Database Password") = "TestPass" cn.Open MsgBox "Data File is now opened" cn.Close End Sub |