|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我希望查询同时满足以下条件信息,但不知道这个代码怎么编写,希望高手朋友帮帮忙:
同时满足:日期、订单号、,型号、颜色
a = "SELECT * FROM 缝纫进出 where 日期 >= #" & [k2] & "# and 日期 <= #" & [l2] & "#"
b = "SELECT * FROM 缝纫进出 where 定单号 >= '" & [m2] & "' and 定单号 <= '" & [n2] & "'"
c = "SELECT * FROM 缝纫进出 where 型号 >= '" & [o2] & "' and 型号 <= '" & [p2] & "'"
d = "SELECT * FROM 缝纫进出 where 颜色 >= '" & [q2] & "' and 颜色 <= '" & [r2] & "'"
Range("a:j").ClearContents
With ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN=MS Access Database;DBQ=" & ThisWorkbook.Path & "\缝纫进出帐.mdb;;;UID=admin;PWD=123", Destination:=Range("A1"))
.CommandText = a
.CommandText = b
.CommandText = c
.CommandText = d
.Refresh BackgroundQuery:=False
End With |
|