vbadatabasems-accesstransfer

TransferDatabase command not transferring data


I am trying to transfer the data and table structure from one database to another.

My database kept bloating, so I moved my linked tables to a separate database and I'm attempting to pull them into a local table in my current DB. When I use the TransferDatabase the DB acts like it's working but there is no data available.

DoCmd.TransferDatabase acLink, "Microsoft Access", "C:\Users\Desktop\External_DataSources.accdb", acTable, "tblLinked", "tblLocal", False

I do not receive any errors, the database just continues running the sequence as if it completed successfully - only no data is shown in the table.


Solution

  • Use:

    docmd.RunSQL ("select * into tblLocal from tblLinked")
    

    For TransferDatabase: If you import a table from another Access database that's a linked table in that database, it will still be linked after you import it. That is, the link is imported, not the table itself.