Success!
Recap of process:
- Create linked tables
- Create corresponding static tables
- Set primary key in static tables
- Write a public function inside a separate module (with different name than the function) with SQL append command to copy linked tables to static tables. Primary key in static tables will prevent duplication. See code below.
- Use VBS script to call VBA. See code below.
- Use Windows Task Scheduler to run VBS script at desired time/frequency
Module code to run SQL append command
Code:
Option Compare Database
Public Function ODBCRefresh()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM StaticTable"
DoCmd.RunSQL "INSERT INTO StaticTable ( Field1, Field2, Field3 ) SELECT LinkedTable.Field1, LinkedTable.Field2, LinkedTable.Field3 FROM LinkedTable;"
DoCmd.SetWarnings True
End Function
VBS script
Code:
Dim accessApp
set accessApp = CreateObject("Access.Application")
accessApp.OpenCurrentDataBase("filepath\DatabaseName.accdb")
accessApp.Run "ODBCRefresh"
accessApp.Quit
set accessApp = nothing