|
楼主 |
发表于 2018-11-9 16:13
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我写了一段代码,可是提示错误,不知道什么原因,望高手指点。
sql1 = "select Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item, Plan_Qty, Sum(Quantity) as StockQty from Stock group by Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item"
sql2 = "select Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item, Sum(Quantity) as InQty from History where Bound_Type like '%In%' group by Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item"
sql3 = "select Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item, Sum(Quantity) as InQty from History where Bound_Type like '%Out%' group by Part_Name, Project_Name, BOM_Name, BOM_Item, PO_Number, PO_Item"
sql4 = "select t.Part_Name,t.Project_Name,t.BOM_Name,t.BOM_Item,t.PO_Number,t.PO_Item,t.InQty,r.OutQty from (" & sql2 & ") as t left join (" & sql3 & ") as r on t.Part_Name=r.Part_Name and t.Project_Name=r.Project_Name and t.BOM_Name=r.BOM_Name and t.BOM_Item=r.BOM_Item and t.PO_Number=r.PO_Number and t.PO_Item=r.PO_Item"
strSQL = "select a.Part_Name as Part_Name, a.Project_Name as Project_Name, a.BOM_Name as BOM_Name, a.BOM_Item as BOM_Item, a.PO_Number as PO_Number, a.PO_Item as PO_Item, b.StockQty, a.InQty, a.OutQty from (" & sql4 & ") as a left join (" & sql1 & ") as b on a.Part_Name=b.Part_Name and a.Project_Name=b.Project_Name and a.BOM_Name=b.BOM_Name and a.BOM_Item=b.BOM_Item and a.PO_Number=b.PO_Number and a.PO_Item=b.PO_Item"
|
-
错误提示
|