Hi,
I have huge problem with password protected Access database. I have code that I use to connect to this Access file (.accdb) from Excel and everything works smoothly. But now as I add password to the Access file I just am not able to connect to it anymore. I get every time this "not a valid password" error. And I'm sure that password is correct. I'm using Excel 2010 and Access 2010. Password is passw .
I've been trying following with different quotation marks positions etc but with no luck:
Code:
Set Cnn = New ADODB.Connection
Cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Practise.accdb;Jet OLEDB:Database Password=passw"
Cnn.Open
-> not a valid password in cnn.open line
Code:
Const sDB = "Practise.accdb"
Set Cnn = New ADODB.Connection
MyConn = ThisWorkbook.Path & Application.PathSeparator & sDB
With Cnn
.Provider = "Microsoft.Ace.OLEDB.12.0; Persist Security Info =false;"
.Properties("jet oledb:database password") = "passw"
.Open MyConn
End With
-> not a valid password in .open MyConn line
Code:
Const sDB = "Practise.accdb"
Set Cnn = New ADODB.Connection
MyConn = ThisWorkbook.Path & Application.PathSeparator & sDB
With Cnn
.Provider = "Microsoft.Ace.OLEDB.12.0; Persist Security Info =false;"
.Open MyConn, Password:="passw"
End With
-> this leads to "Cannot start your application. The workgroup information file is missing or opened exclusively by another user." Workgroup information file? It is not opened by another user.
I'm getting really desperate here. Any help please?