I want to connect with password protected access file. with below coding, I am getting an error as "Incorrect password" but when I open it manually with the same password, its open. Do I get to make any changes in database setting.
Dim Acon As New ADODB.Connection
Dim Rs As New ADODB.Recordset
With Acon
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" + "U:\scratch\OK.accdb"
.Properties("Jet OLEDB:Database Password") = "123"
.Open
End With
Yes you will get that problem. To sort it, follow the steps exactly as I tell you
Exclusive
Decrypt the database from the File menu
Click on File|Options|Client Settings and navigate to the end and select the options shown below
OK
in the above screen. Code I used for testing
Sub Sample()
Dim Acon As New ADODB.Connection
Dim Rs As New ADODB.Recordset
With Acon
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "C:\Users\Siddharth\Desktop\Database3.accdb"
.Properties("Jet OLEDB:Database Password") = "test"
.Open
End With
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.