• Replacement for Transferdatabase method to IMPORT. (ACCESS 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Replacement for Transferdatabase method to IMPORT. (ACCESS 2000)

    Author
    Topic
    #374587

    I am having problems using the TransferDatabase method to export or import tables to/from password protected Access 2000 database. I get “2001 – You have cancelled the previous operation.” error messages. I finally resorted to using the CopyObject method to export my table, which works fine.

    What I can use to replace the TransferDatabase method for my import?

    Thanks,

    Randy

    Viewing 0 reply threads
    Author
    Replies
    • #606385

      Try the following code :

      Sub CopyTable()
      Dim db As DAO.Database
      Dim ws As DAO.Workspace
      Set ws = DBEngine.Workspaces(0)
      Set db = ws.OpenDatabase("C:protecteddb.mdb", False, False, "MS Access;PWD=secret")
      db.Execute "SELECT table1.* INTO table1 IN '" & CurrentDb.Name & "' FROM table1;"
      db.Close
      Set db = Nothing
      Set ws = Nothing
      End Sub

      Replace C:protecteddb.mdb with database name and path where the table to be imported is.
      Replace secret with your password
      Replace table1 with the name of the table to be imported
      If you haven’t done it already, add the reference to Microsoft DAO 3.6 Object Library in Tools, References.
      This will not overwrite the table if it already exist. Delete the table before running the code.

      • #606387

        Francois,

        Thank you very much for this valuable information.

        Randy

    Viewing 0 reply threads
    Reply To: Replacement for Transferdatabase method to IMPORT. (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: