R
Ron
I am using the following code to link tables from a back-end db, it doesn't
link to all of them for some reason and the ones that are linked appear
twice.
Private Sub Command5_Click()
Dim PathName As String
NewPathName = Application.CurrentProject.Path & "\Service Tables.mdb"
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs
For Each Tdf In Tdfs
If Tdf.SourceTableName <> "" Then
Tdf.Connect = ";DATABASE=" & NewPathName 'Set the new source
DoCmd.TransferDatabase acLink, "Microsoft Access", NewPathName,
acTable, Tdf.SourceTableName, Tdf.SourceTableName
Tdf.RefreshLink 'Refresh the link
End If
Next
End Sub
Any hints appreciated,
Ron.
link to all of them for some reason and the ones that are linked appear
twice.
Private Sub Command5_Click()
Dim PathName As String
NewPathName = Application.CurrentProject.Path & "\Service Tables.mdb"
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs
For Each Tdf In Tdfs
If Tdf.SourceTableName <> "" Then
Tdf.Connect = ";DATABASE=" & NewPathName 'Set the new source
DoCmd.TransferDatabase acLink, "Microsoft Access", NewPathName,
acTable, Tdf.SourceTableName, Tdf.SourceTableName
Tdf.RefreshLink 'Refresh the link
End If
Next
End Sub
Any hints appreciated,
Ron.