I'm not finding how I can do this, I would like to have some link tables set up, but done by relative pathnames so the pathname to the data file can be different from different computers.
Check the Microsoft site. They have examples of linking tables through code. Here is an example of linking 1 table. This could be modified to set up a loop to link the tables you want.
Public Function CreateLinkedTable()
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
' Open the catalog.
cat.ActiveConnection = CurrentProject.Connection
' Create the new Table.
tbl.Name = "Linked_Employees"
Set tbl.ParentCatalog = cat
' Set the properties to create the link.
tbl.Properties("Jet OLEDB:Link Datasource") = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
tbl.Properties("Jet OLEDB:Remote Table Name") = "Employees"
tbl.Properties("Jet OLEDB:Create Link") = True
' Append the table to the Tables collection.
cat.Tables.Append tbl
Set cat = Nothing
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.