Share via

Access database to database table transfer

Anonymous
2013-08-01T13:31:15+00:00

Hi all,

I'm trying to transfer data from one access db table to a different access db table. Both source and target tables have the same structure. The code successfully imports the data from the source table into the current db BUT it puts the data into a NEW table instead of importing the data into the target table.

DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\SourceDBFileName.accdb", acTable, "SourceTableName", "TargetTableName"

If any one can help point out what I am doing wrong, I would be very thankful!

Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2013-08-02T01:32:43+00:00

    Very odd. Maybe you edited the OP? It used to say:

    DoCmd.TransferDatabase, acImport, "Microsoft Access", "TargetDatabaseName.accdb", acTable, "C:\SourceFolderName\SourceFileName.accdb", "SourceTableName", "TargetTableName"

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,830 Reputation points Volunteer Moderator
    2013-08-01T16:54:18+00:00

    You may need to link to the table and run an Append query.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-08-01T16:07:20+00:00

    Thanks Tom for the response!

    I don't have a comma after the word "DoCmd.TransferDatabase".

    Also I meant to clarify that the reason I want to transfer the data from db.SourceTable to db.TargetTable INSTEAD of just importing the tables is because there are other fields in the TargetTable that I have added or changed attributes on. The source tables do not have these new fields. I just want to transfer the data from the fields that are common to the 2 tables.

    Hope that makes sense!

    Thanks!

    Was this answer helpful?

    0 comments No comments
  4. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2013-08-01T13:54:45+00:00

    Remove the comma after TransferDatabase.

    Was this answer helpful?

    0 comments No comments