R
RLN
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....
<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....