View Single Post
  #1  
Old December 18th, 2009, 09:27 AM posted to microsoft.public.access
K[_4_]
external usenet poster
 
Posts: 25
Default Change one table link by vba

Hi all, I got macro below which changes the link of all linked tables
in access. How can I ammend it to change only one table link with the
name "Summary". Please can any friend can help

Public Sub RelinkTables()
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs
'Loop through the tables collection
For Each Tdf In Tdfs
If Tdf.SourceTableName "" Then 'If the table source is other than a
base table
Tdf.Connect = ";DATABASE=\\Home\Document\Record.mdb"
Tdf.RefreshLink 'Refresh the link
End If
Next 'Goto next table
End Sub