|
- Set SH0 = Worksheets("订单总表")
- Set SH1 = Worksheets("订单查询")
-
-
- Str_coon = "HDR=yes';Data Source =" & ThisWorkbook.FullName '//OFFICE2003,2007 通用
- StrSQL = ""
- StrSQL = StrSQL & "SELECT [下单日期],[客户名称序列],[产品名称序列],[订单编号],[下单日期1]"
- StrSQL = StrSQL & ",[客户名称],[客户_产品名称],[我司_产品名称],[原料名称],[颜色],[色号]"
- StrSQL = StrSQL & ",[订单_数量],[订单_单位],[单件_数量],[装箱_单位],[装箱_件数],[件数_单位]"
- StrSQL = StrSQL & ",[零数],[零数_单位],[工艺要求],[交货日期],[单价_(元)],[订单货款_金额_(元)],[备注]"
- StrSQL = StrSQL & " FROM [" & SH0.Name & "$A4:IT]"
- StrSQL = StrSQL & " WHERE 1=1"
- If Len(SH1.Range("D2").Value) > 0 Then StrSQL = StrSQL & " AND [客户名称]='" & SH1.Range("D2").Value & "'"
- If Len(SH1.Range("G2").Value) > 0 Then StrSQL = StrSQL & " AND [我司_产品名称]='" & SH1.Range("G2").Value & "'"
- If Len(SH1.Range("K2").Value) > 0 Then StrSQL = StrSQL & " AND [下单日期]>=#" & SH1.Range("K2").Value & "#"
- If Len(SH1.Range("M2").Value) > 0 Then StrSQL = StrSQL & " AND [下单日期]<=#" & SH1.Range("M2").Value & "#"
-
- SQLARR = GET_SQL_To_Arr(StrSQL, Str_coon, True)
- SH1.Range("A5:Z1048576").ClearContents
- SH1.Range("B5").Resize(UBound(SQLARR, 1) + 1, UBound(SQLARR, 2) + 1) = SQLARR
复制代码
|
|