PDA

View Full Version : Invalid Password



brucel_SA
01-24-2008, 11:54 PM
Public Sub GetCn(ByRef dbcon As ADODB.Connection, ByRef dbrs As ADODB.Recordset, _
sqlstr As String, dbfile As String, usernm As String, pword As String)

Set dbcon = New ADODB.Connection
dbcon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbfile & ";", _
"", age
Set dbrs = New ADODB.Recordset

dbrs.Open sqlstr, dbcon

End Sub

i am using the above sub to connect to a mdb access file. i have encrypted the file with a password for eg:"age". when i run my marco it gives me invalid password...

RonMcK
01-25-2008, 08:28 AM
Bruce,

Since your sub is receiving the password in in the variable 'pword', shouldn't you use that in your dbcon.open line instead of 'age' (the password itself)? On the other hand, if you want to hardcode the sub with this specific password, shouldn't you enclose it in quotes (e.g. "age")?

Ron