Hello,
I wrote vba code in Excel that retrieves data from Access db. It was working well until I split and password encrypted the database. The back-end is on the network. So now when I tried to import data, I get an error message "Run time Error 3031. Not a valid password"
I tried changing File/Options/Client Settings/Use Legacy Encryption and then splitting and password protecting the database but it still throws the same error message.
Is there a way to feed the password to the OpenDatabase statement and get this to work?
Here is my current code:
Thanks
I wrote vba code in Excel that retrieves data from Access db. It was working well until I split and password encrypted the database. The back-end is on the network. So now when I tried to import data, I get an error message "Run time Error 3031. Not a valid password"
I tried changing File/Options/Client Settings/Use Legacy Encryption and then splitting and password protecting the database but it still throws the same error message.
Is there a way to feed the password to the OpenDatabase statement and get this to work?
Here is my current code:
Code:
Dim db As Database
Dim qdf As QueryDef
Dim rs As Recordset
Dim ws As Worksheet
Dim strConnection As String
Dim j As Long
Dim i As Long
Dim xls As Object
Set ws = ThisWorkbook.Worksheets("Data")
Set db = OpenDatabase("L:\Database\database.accdb")
Set qdf = db.QueryDefs("graph_variant_final_Crosstab")
Set rs = qdf.OpenRecordset
Last edited: