答案1
您需要安装 accessdatabaseengine.exe 或 accessdatabaseengine_X64.exe 才允许使用此方法。
Dim cn, rs 'For database access
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
connectionString = "Provider=Microsoft.ACE.OLEDB.16.0; Data Source=d:\inventory.accdb"
cn.Open connectionString
rs.ActiveConnection = connectionString
然后在代码中
cn.Execute "<your SQL statement goes here update table1>"
cn.Execute "<your SQL statement goes here update table2>"
SQL 示例请点击此处
cn.Execute "update table set name='"&name&"' where othervalue=`"&othervalue&"';"