Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Checking Linked Tables

0 views
Skip to first unread message

RLN

unread,
Jul 24, 2008, 11:38:01 AM7/24/08
to
I have this code I got off of the web to change the table links:
<begincode>
Public Sub RelinkTables(prmNewDBPath As String)
'Original Code
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Dim strMsg As String
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs

'Loop through the tables collection
For Each Tdf In Tdfs
If Left(Tdf.SourceTableName, 3) = "tbl" Then
Tdf.Connect = ";DATABASE=" & prmNewDBPath
Tdf.RefreshLink
strMsg = strMsg & "Linked: " & prmNewDBPath & "--" &
Tdf.SourceTableName & vbCrLf
End If
Next

MsgBox " Tables Linked successfully: " & vbCrLf & vbCrLf & strMsg,
vbOKOnly + vbInformation, "ReLinkTables"
End Sub
<end code>

Before I run this to actually change the links to another .mdb, I would like
to see what db the tables are linked to before they are changed. Is there a
simple way to check this?

Thanks....

Klatuu

unread,
Jul 24, 2008, 3:38:06 PM7/24/08
to
The connect property of the tabledef object contains the path to the mdb that
contains the linked table.

So in your code Here:


For Each Tdf In Tdfs

Debug.Print "Table " & tdf.Name & " Connection is " & tdf.Connect


If Left(Tdf.SourceTableName, 3) = "tbl" Then

--
Dave Hargis, Microsoft Access MVP

RLN

unread,
Jul 24, 2008, 4:14:03 PM7/24/08
to
This worked great! thank you so much.
0 new messages