在EXCEL中导入了从ACCESS的数据,VBA中的代码:
selectSql ="select * from `E:\Text\COP_Tool`.`ls_dpdm` where storecode='" & store & "' and subcode=(select min(subcode) from `E:\Text\COP_Tool`.`ls_dpdm` a where a.storecode=storecode and a.dept+a.itemcode=dept+itemcode)"
Sheets("Sheet1").QueryTables(1).Connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Text\COP_Tool.mdb;Persist Security Info=False"
Sheets("Sheet1").QueryTables(1).Sql = selectSql
Sheets("Sheet1").QueryTables(1).Refresh BackgroundQuery:=False
运行出错‘1004’,该怎么写才能将前台的数据更新为后台的SQL
提供一种在EXCEL使用代码,连接ACCESS,取得数据的方法,看是不是你要的东西: