Consulting

Results 1 to 2 of 2

Thread: Invalid Password

  1. #1

    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...

  2. #2
    VBAX Expert
    Joined
    Aug 2007
    Location
    Windermere, FL, a 'burb in the greater Orlando metro area.
    Posts
    567
    Location
    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
  •