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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need code to link table access 97 in another access 97 db ?

Status
Not open for further replies.

FluFFy05

Programmer
Jul 4, 2000
19
CA
I have 2 db, the 1 first is Read Only ans the second is me db, i need to attach(link) some tables from the first table

I know that it more simple directly in access, but i can't, because i have more than 1 db in read only and i want to attach(link) this table in the selectionned db in a scroll down menu !!

thanks a lot !!

 
I assume your using ADO, is so set a reference to MS Jet and Replication Objects, this allows you to link tables.
Below is a small section of code I use, you should be able to pick the bits out you need to make it work for you.

Regards, Nick
For Each tblMST In cat.Tables
If tblMST.Type = "TABLE" Then
' ----- Append Linked Tables
Set cat1 = New ADOX.Catalog
Set tbl = New ADOX.Table
cat1.ActiveConnection = cn
tbl.Name = tblMST.Name
Set tbl.ParentCatalog = cat1
tbl.Properties("JET OLEDB:Link Datasource") = cMasterDB
tbl.Properties("JET OLEDB:Remote Table Name") = tblMST.Name
tbl.Properties("JET OLEDB:Create Link") = True
cat1.Tables.Append tbl
Set cat1 = Nothing
End If
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top