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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Open with VBA a Password protected db (Win XP Office 2003)

    Author
    Topic
    #456188

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1138786

      You can specify the password like this:

      Set dbs = OpenDatabase(strLocation, False, False, ";pwd=secret")

      Note the semicolon before pwd=. This is required.

      See the help for OpenDatabase for more info.

    Viewing 0 reply threads
    Reply To: Open with VBA a Password protected db (Win XP Office 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: