嗨,我想要我的宏:
更改我的request_MANDescriptifAdr.mdb的链接表管理器中的链接,以获取来自MANDescriptifAdr.mdb的表SIGAdPoAAAAMMJJRXX_ORI
Private Sub CommandButton6_Click()
Dim folderPath As String
folderPath = Application.ActiveWorkbook.Path
Dim db As Object
Set db = CreateObject("ADODB.Connection")
OpenDatabase = folderPath & "Request_MANDescriptifAdr.mdb"
db.OpenDatabase = folderPath & "Request_MANDescriptifAdr.mdb"
db.TableDefs("SIGAdPoAAAAMMJJRXX_ORI").Connect = "MS Access;DATABASE=" & folderPath & "MANDescriptifAdr.mdb"
db.TableDefs("SIGAdPoAAAAMMJJRXX_ORI").RefreshLink
End Sub
答案 0 :(得分:1)
我以为我已经在你上一期的评论部分回答了这个问题,但是没关系:
Private Sub CommandButton6_Click()
Dim folderPath As String
folderPath = Application.ActiveWorkbook.Path
Set Db = CreateObject("DAO.DBENGINE.120").OpenDatabase(folderPath & "Request_MANDescriptifAdr.mdb")
db.TableDefs("SIGAdPoAAAAMMJJRXX_ORI").Connect = "MS Access;DATABASE=" & folderPath & "MANDescriptifAdr.mdb"
db.TableDefs("SIGAdPoAAAAMMJJRXX_ORI").RefreshLink
End Sub