Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open with VBA a Password protected db (Win XP Office 2003)

    I am trying to open up a dynaset recordset in VBA code using a db different from the one with the code. The external db is password protected. How do I include a parameter in my code to permit opening the external db?

    Here is the line of code to open the external recordset:

    strLocation = conPWLocation
    strTable = "tblPasswords"
    Set dbs = OpenDatabase(strLocation)
    Set rstPasswords = dbs.OpenRecordset(strTable, dbOpenDynaset)

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open with VBA a Password protected db (Win XP Office 2003)

    You can specify the password like this:
    <code>
    Set dbs = OpenDatabase(strLocation, False, False, ";pwd=secret")
    </code>
    Note the semicolon before pwd=. This is required.

    See the help for OpenDatabase for more info.

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open with VBA a Password protected db (Win XP Office 2003)

    Great! We are OK. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •