• Transfer database (Access 2000)

    Author
    Topic
    #443776

    I have problems with the command TransferDatabase.When i open a database with a password, it is OK, but when i add on the command TransferDatabasesekd, i am asked for the password, even though the password exists in the command :
    Public Function ExportTables()
    Dim wsp As DAO.Workspace
    Dim StrPassword As String
    StrPassword = “secret”
    Set wsp = DAO.DBEngine.Workspaces(0)
    Dim dbs As DAO.Database
    Set dbs = wsp.OpenDatabase(“C:BEstoreBE.mdb”, False, False, “;PWD=” & StrPassword)
    DoCmd.TransferDatabase acExport, “Microsoft Access”, (“C:BEstoreBE.mdb”), acTable, “Customers”, “Customers”
    dbs.Close
    End Function

    If i remove the command Transferdatabase, then i get no error and i am not asked for the password.What is wrong with my function ?

    Viewing 0 reply threads
    Author
    Replies
    • #1071280

      The DoCmd.TransferDatabase instruction has nothing to do with the OpenDatabase instruction that precedes it. The instructions serve completely different purposes. You cannot supply a database password to TransferDatabase.

      Instead of exporting to the password-protected database, you can import into it.

      • #1071286

        Thank you Hans. Just to bring my question to the end is it absolutely impossible to send a table to a password protected database ? For example with copy object or some other method ?

        • #1071287

          You could try using SendKeys. Let’s say that the password is “Secret”.

          SendKeys "Secret~"
          DoComd.TransferDatabase ...

          The ~ at the end of the SendKeys instruction corresponds to the Enter key.

    Viewing 0 reply threads
    Reply To: Transfer database (Access 2000)

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

    Your information: