Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Replacement for Transferdatabase method to IMPORT. (ACCESS 2000)

    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

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replacement for Transferdatabase method to IMPORT. (ACCESS 2000)

    Try the following code :
    <pre>Sub CopyTable()
    Dim db As DAO.Database
    Dim ws As DAO.Workspace
    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase("Crotecteddb.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</pre>

    Replace Crotecteddb.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.
    Francois

  3. #3
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replacement for Transferdatabase method to IMPORT. (ACCESS 2000)

    Francois,

    Thank you very much for this valuable information.

    Randy

Posting Permissions

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