-
Invalid Password
[VBA]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[/VBA]
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...
-
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules