I've found some code on the web, like below
But I always got the error "Item not found in this collection". And it's cause by the line "Set tdf = dbs.TableDefs("target_table")"
Of course. The table "target_table" is in the backend thePathToTheAccdb file. Not "CurrentDb".
Is there a way to link a table which is reside in another accdb file ?
Code:
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("target_table")
tdf.Connect = ";DATABASE=" & thePathToTheAccdb
tdf.RefreshLink
Of course. The table "target_table" is in the backend thePathToTheAccdb file. Not "CurrentDb".
Is there a way to link a table which is reside in another accdb file ?