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!

table linking

Status
Not open for further replies.

mikeba1

Programmer
Jan 2, 2005
235
GB
I have an access application running in several locations.
It is split into a front and back ends.
There is only one front end, depending on what tables are present different procedures are performed.
I would like to automate the table linking.
I have seen many ways of re-linking, however this will not work for me as different tables exist at different locations.
What I need is the ability to point to a back end location and link to all the tables present.in that particular location.
Thank you

 
You should be able to define a DAO.Database object referencing the particular location. Then just loop through the tabledefs and link them with some existing linking code. You would want to ignore and tabledef.names beginning with "msys".

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane
Could you explain the creation of a temporary database object with a specific path !!
 
I have the following code to link tables from the new location

Private Sub Command7_Click()
Dim wrkJet As Workspace
Dim db1 As DAO.Database
Dim rs As DAO.Recordset
Dim tdf As TableDef
Dim i As Integer

Set wrkJet = CreateWorkspace("JetWorkspace", "admin", "", dbUseJet)
Set db1 = wrkJet.OpenDatabase(Me.datapath)

i = 0
For Each tdf In db1.TableDefs
If Left(tdf.name, 4) <> "MSys" Then
i = i + 1
If Len(tdf.Connect) > 0 Then
MsgBox (tdf.name & " " & i)
tdf.Connect = ";DATABASE=" & Me.datapath
tdf.RefreshLink
End If
End If
Next
MsgBox ("no of tables on this db is " & i)
End Sub

However it assumes the table has been linked before?
This may not be the case, different locations have different tables.
What I need to do is firstly delete the links from the front end and then link ALL tables from the new location
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top