Mez
Mez

Reputation: 2857

Copy tables between access databases

I have two access databases and would like to find a way to copy tables from one database to the other. The copied table has to keep the same strucure and data.

I already tried to fiddle around with sqlBulkcopy but all information i can found about it is using sqlBulkCopy to tranfer tables to sql server.

Can I use sqlBulkCopy to copy tables between mdb files or is there another way to do this ?

Upvotes: 1

Views: 3481

Answers (2)

Christian Specht
Christian Specht

Reputation: 36451

You can import the whole table including keys and data from one Access database into the other by running this in the destination database:

DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\Source_Database.mdb", acTable, "Source_Table", "Destination_Table"

Upvotes: 0

Anton Gogolev
Anton Gogolev

Reputation: 115857

Try this:

insert into [AccessTable] 
    select * from [MS Access;DATABASE=D:\My Documents\db2.mdb].[AccessTable2]

Upvotes: 3

Related Questions