我正在尝试使用Gord的代码来打开和更新数据库。我已将数据库路径修改为我的位置。要更新的数据库已关闭,没有其他用户。任何帮助将不胜感激。这就是我所拥有的:
Sub UpdatePublicDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdatePublicDatabase_OpenError
con.Open _
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
"Dbq=C:\Users\wfejr\Desktop\Sean's Program Files\Access Sales Tax Database.accdb;" & _
"Exclusive=1;" & _
"Uid=admin;" & _
"Pwd=;"
On Error GoTo 0
con.Execute "DELETE FROM UpdateInfo"
con.Execute "INSERT INTO UpdateInfo SELECT * FROM [MS Access;DATABASE=" & Updater.accdb & ";].[UpdateInfo]"
con.Close
Debug.Print "Done."
Exit Sub
UpdatePublicDatabase_OpenError:
Debug.Print "Exclusive 'Open' failed. Quitting."
Exit Sub
End Sub