PARAMETERS [First Date] DateTime, [Second Date] DateTime, [Shift] Text ( 255 );
SELECT
Main.[Mth/day],
Main.Shift,
([Run Hrs]*[Actual Lbs/hr]) AS [Gross Production - LBS],
[Scrap Lbs 1]+[Scrap Lbs 2]+[Scrap Lbs 3] AS [Scrap Produced - LBS],
[Run Hrs]*[Actual Lbs/hr]-([Scrap Lbs 1]+[Scrap Lbs 2]+[Scrap Lbs 3]) AS [Net Production],
[Run Hrs]*[Actual Lbs/hr]*0.035 AS [Scrap Target],
[Run Hrs]*[Std lbs/hr]-([Run Hrs]*[Actual Lbs/hr])*0.035 AS [Target Net Production],
[Run Hrs]*[Std lbs/hr] AS [Target Gross Production],
(([Run Hrs]*[Std Lbs/hr])/([Run Hrs]*[Actual Lbs/hr]*0.035)) AS [Target Scrap Rate]
FROM Main
WHERE
(((Main.[Mth/day]) Between [First Date] And [Second Date]
And [Shift]=Main.Shift
And [Std lbs/hr]>0));
I need to also sum each calculated field so they can also retrieve monthly summaries and the like. Can i do this in the same query or am I best to make another query based off of this one’s results?
This is really something that should be handled in the front-end or report writer, not through SQL.
In MS Access 2007 the following should work:
A cell should be added to the report footer with your aggregate.