Dim Filter As String With e.Form.Controls("DropBox1") If .Value IsNot Nothing Then Filter = "内部加工单号 in ('" & .Value.replace(",","','") & "')" End If End With With e.Form.Controls("combobox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "工段 = '" & .Value & "'" End If End With With e.Form.Controls("DropBox3") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "产品名称 = '" & .Value & "'" End If End With |
Tables("窗口1_table1").Fill(" Sel ect c.材料,d.产品编码,d.内部加工单号,d.分厂,d.订单数量,d.物料名称,d.图纸号,d.图纸信息,d.订单配色,d.方案,d.方案配色,d.部件名称,d.部件规格,d.部件图纸,d.部件量,d.工段,d.组件名称,d.组件规格,d.组件量,d.计算规格,d.工序量,d.配色,d.工序名称,d.工序规格,d.工序说明,d.单位,d.人数,d.厂内单价,d.修改定额,d.定额 from {配色} c inner join (S elect b.材料1,b.产品编码,b.内部加工单号,b.分厂,b.订单数量,b.物料名称,b.图纸号,b.图纸信息,b.订单配色,b.方案,b.方案配色,b.部件名称,b.部件规格,b.部件图纸,b.部件量,b.工段,b.组件名称,b.组件规格,b.组件量,b.计算规格,b.工序量,b.配色,b.工序名称,b.工序规格,b.工序说明,b.单位,b.人数,a.厂内单价,a.修改定额,a.定额 from {工序价格} a inner join (Sel ect 内部加工单号,产品编码,订单数量,分厂,订单配色,物料名称,{物料表}.图纸号,图纸信息,方案,方案配色,部件名称,部件规格,部件量,部件图纸,{工序库明细}.工段,组件名称,组件规格,组件量,计算规格,工序量,配色,产品工序规格,{工序库明细}.价格编号,{工序库明细}.材料1,工序名称,工序规格,工序说明,{工序表新}.单位,人数 From (((({物料表} Inner JOIN {订单明细表} ON {订单明细表}.[产品编码] = {物料表}.[物料编码]) Inner JOIN {工库方案} ON {工库方案}.[物料编码] = {订单明细表}.[产品编码] And {工库方案}.[方案] = {订单明细表}.[订单配色]) Inner JOIN {工序库明细主表} ON {工序库明细主表}.[物料编码] = {工库方案}.[物料编码]) Inner JOIN {工序库明细} ON {工序库明细}.[编码] = {工序库明细主表}.[编码]) Inner JOIN {工序表新} ON {工序表新}.[工序编号] = {工序库明细}.[工序编码] "& iif (filter > "", " Where " & filter,"") ) b on a.价格编号= b.价格编号 where b.方案配色 =b.配色 Or b.配色 = 0) d on c.物料编码 = d.产品编码 And c.方案 = d.方案 And c.材料编号 =d.材料1" ,"s",True)
版主我这个红色部分怎么还是不对。
下面这个就行
Tables("窗口1_table1").Fill("S elect 内部加工单号,产品编码,订单数量,分厂,订单配色,物料名称,{物料表}.图纸号,图纸信息,方案,方案配色,部件名称,部件规格,部件量,部件图纸,{工序库明细}.工段,组件名称,组件规格,组件量,计算规格,工序量,配色,产品工序规格,{工序库明细}.价格编号,{工序库明细}.材料1,工序名称,工序规格,工序说明,{工序表新}.单位,人数 From (((({物料表} Inner JOIN {订单明细表} ON {订单明细表}.[产品编码] = {物料表}.[物料编码]) Inner JOIN {工库方案} ON {工库方案}.[物料编码] = {订单明细表}.[产品编码] And {工库方案}.[方案] = {订单明细表}.[订单配色]) Inner JOIN {工序库明细主表} ON {工序库明细主表}.[物料编码] = {工库方案}.[物料编码]) Inner JOIN {工序库明细} ON {工序库明细}.[编码] = {工序库明细主表}.[编码]) Inner JOIN {工序表新} ON {工序表新}.[工序编号] = {工序库明细}.[工序编码] " & iif (filter > "", " Where " & filter,""), "1",True)
'Tables