Dim td As TableDef
Dim db As DAO.Database
Dim strOld As String
Dim strNew As String
'replace the following strings as needed
strOld = "C:\Users\June\Forums"
strNew = "C:\Users\June"
Set db = CurrentDb
For Each td In db.TableDefs
If InStr(td.Connect, strOld) > 0 Then
Debug.Print td.name
Debug.Print "Old Link: " & td.Connect
td.Connect = Replace(td.Connect, strOld, strNew)
td.RefreshLink
Debug.Print "New Link: " & td.Connect
End If
Next td
db.TableDefs.Refresh
1条答案
按热度按时间nkkqxpd91#
可以使用vba修改链接。示例代码: