I have created (with a little help from Andrew Couch) a piece of code to change the linked tables.
Can anyone advise how I can get this to pickup the new path from a messagebox, instead of changing the path to c:\data\data2.accdb I am trying to make this user selectable.
Code:
Private Sub Command32_Click()
Dim tdef As TableDef
Dim Strnew As String
Strnew = ";database=C:\data\data2.accdb"
For Each tdef In CurrentDb.TableDefs
If Left(tdef.Connect, Len(";Database=")) = ";database=" Then
If InStr(tdef.Connect, "data1.accdb") Then
Debug.Print tdef.Name; tdef.Connect
tdef.Connect = Strnew
tdef.RefreshLink
End If
End If
Next
End Sub