M
MikeF
Would like to change the drive letter of linked tables when necessary.
Have the following code in a module, but when I attempt to run it the macro
dialog appears.
What else needs to be done?
Thank you.
- Mike
Private Sub RelinkTables(path, db)
Dim dbs As Database
Dim tdf As TableDef
' Loop through all tables in the database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & path & "\" & db
Err = 0
On Error Resume Next
tdf.RefreshLink ' Relink the table.
If Err <> 0 Then
End If
End If
Next tdf
End Sub
Have the following code in a module, but when I attempt to run it the macro
dialog appears.
What else needs to be done?
Thank you.
- Mike
Private Sub RelinkTables(path, db)
Dim dbs As Database
Dim tdf As TableDef
' Loop through all tables in the database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & path & "\" & db
Err = 0
On Error Resume Next
tdf.RefreshLink ' Relink the table.
If Err <> 0 Then
End If
End If
Next tdf
End Sub