简体   繁体   中英

MS Access - VBA - Cloning a Table

I wanted to basically copy the entire content of one table to another.

Context:

  • Table source is SharePoint list and triggers an email per record being queried. No way to turn it off on my end as it's being utilised by another team.
  • When I run my queries on a local table, it's fine.

I need to just copy the data directly. So far, the only code I found is

DoCmd.TransferDatabase but I can't seem to configure it correctly.

Simplest method is probably to run a make-table query to (re)create the local table:

Dim Sql As String

Sql = "SELECT * INTO LocalTable FROM SharePointTable;"
CurrentDb.Execute Sql

That will pop a warning, though. If that is too much, create the local table, then run two queries - the first to delete all records from the local table, the second to append all records from the SharePoint table to the local table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM