Hi, I'm using VB6 to connect to Ms Access 2010 (accdb format).
The library i'm using is "Microsoft Office 14.0 Access database engine Object Library"
The accdb file is created with a password. But program hit "Run-time error 3031. Not a valid password" whenever attempt to open the connection. I'm sure the password is correct.
Any help will be appreciated.
My code as below:
Sub OpenDB()
Dim db As DAO.Database
Dim ws As DAO.Workspace
Dim rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("database1.accdb", False, False, ";PWD=12345")
Set rst = db.OpenRecordset("house", dbOpenDynaset)
If rst.RecordCount > 0 Then
rst.MoveLast
MsgBox rst!address
End If
rst.Close
db.Close
End Sub