Ms access 移动目录时更新链接表
我有3个Access数据库链接,当我将它们从一台计算机移动到另一台计算机时,我必须更新它们 我一直在尝试下面的代码,这似乎工作良好,直到刷新部分。。。当我收到“找不到可安装的ISAM”。。。有什么办法解决这个问题吗Ms access 移动目录时更新链接表,ms-access,vba,Ms Access,Vba,我有3个Access数据库链接,当我将它们从一台计算机移动到另一台计算机时,我必须更新它们 我一直在尝试下面的代码,这似乎工作良好,直到刷新部分。。。当我收到“找不到可安装的ISAM”。。。有什么办法解决这个问题吗 Private Sub RelinkTables() Dim oldConnection As String Dim newConnection As String Dim currentPath As String currentPath = CurrentProject.Pat
Private Sub RelinkTables()
Dim oldConnection As String
Dim newConnection As String
Dim currentPath As String
currentPath = CurrentProject.Path
Dim tblDef As TableDef
For Each tblDef In CurrentDb.TableDefs
oldConnection = tblDef.Connect
If Right(oldConnection, 7) = "l.accdb" Then
newConnection = currentPath & "\PL.accdb"
Else
If Right(oldConnection, 7) = "d.accdb" Then
newConnection = currentPath & "\MasterDB - consolidated.accdb"
Else
newConnection = currentPath & "\analysis.accdb"
End If
End If
tblDef.Connect = newConnection
tblDef.RefreshLink
Next
End Sub
以下是源位于另一个Access数据库中的链接表的
.Connect
属性
?CurrentDb.TableDefs(“tblUser”).Connect
;DATABASE=C:\share\Access\loginexample.mdb
构建这些新连接字符串时,代码不包括“DATABASE=”片段。您可以将它添加到currentPath字符串中,然后它将包含在新连接字符串中
currentPath=“;DATABASE=“&CurrentProject.Path
MS说其原因是ACcess无法访问支票中的信息: