Hi everyone,
I have an access database in which all of the tables are linked to SharePoint Lists.
I'm trying to figure out which is the best way to write a macro that creates a copy of the whole .ACCDB file, in which all of the linked tables are converted into local tables.
I've tryed with this code (it runs when the button "BAK" is clicked):
Code:
Private Sub BAK_Click()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
If Not Left(tdf.Name, 4) = "MSys" Then
DoCmd.SelectObject acTable, tdf.Name, True
DoCmd.RunCommand acCmdConvertLinkedTableToLocal
End If
Next
End Sub
The problem is that the
Code:
acCmdConvertLinkedTableToLocal
command converts the tables to local tables, and then there is no way to get the original linked tables back after the backup file is created (by copy-paste into a different directory).
I've found also this command:
Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject.Path & "\DATABASE.accdb", acTable, "SharePointTable", "LocalTable", 0
but it doesn't seem to work properly.
What is the best practice to do backup these tables?