Query Issue

Copper Contributor

Originally I was attempting to perform Dsum to get query results; however, it was suggested I use something similar to the following...


The SQL appears as...

SELECT tblProj.CNoWBSE, tblWO.WOID, tblWO.WONo, Sum(tblEMES.EMESCst) AS SumOfEMESCst, Sum(tblELbr.ECraftCst) AS SumOfECraftCst, Sum(tblAMES.[Valin RepCurMES]) AS [SumOfValin RepCurMES], Sum(tblALbr.[Valin RepCurLbr]) AS [SumOfValin RepCurLbr]
FROM ((((tblProj LEFT JOIN tblWO ON tblProj.ProjID = tblWO.WOID) LEFT JOIN tblEMES ON tblWO.WONo = tblEMES.WOOrder) LEFT JOIN tblAMES ON tblWO.WONo = tblAMES.WOOrder) LEFT JOIN tblELbr ON tblWO.WONo = tblELbr.WOOrder) LEFT JOIN tblALbr ON tblWO.WONo = tblALbr.WOOrder
WHERE (((tblALbr.[Cost Element])<>890001)) OR (((tblALbr.[Cost Element])<>890002))


The query results are not matching the information I am receiving from my Form/Subform information (which is correct).  As shown, what I really need is to add the sum of the EMESCst and sum of ECraftCst  to create EBudget and add the sum of the Valin repCurMES and sum of Valin repCurLbr to create AExpense.  Then create a Var (expression) calculating the difference between EBudget and AExpense.


Can someone assist with what I'm doing incorrectly?

0 Replies