- 9
- 0
- 约11.41万字
- 约 9页
- 2016-12-03 发布于河南
- 举报
使用VBA执行QL
A、根据本工作簿的1个表查询求和写法范本
Sub 查询方法一()
Set CONN
CONN.Open provider=microsoft.jet.oledb.4.0;extended
properties=excel 8.0;data source= ThisWorkbook.FullName
sql = select 区域,存货类, sum(代销仓入库数量),sum(代销仓出库数量),sum(日报数量)from
[sheet4$a:i] where 区域= [b3] and month(日期)=
Month(Range(F3)) group by 区域,存货类
Sheets(sheet2).[A5].CopyFromRecordset CONN.Execute(sql)
CONN.Close: Set CONN
End Sub
-----------------
Sub 查询方法二()
Set CONN
CONN.Open
原创力文档

文档评论(0)