Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access XP - link tables by relative paths

Status
Not open for further replies.

dakota81

Technical User
May 15, 2001
1,691
US
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.

Thanks in advance.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top