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" wrote:
> 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....
|