Try This:
Code:
SELECT
TC.ComponentName,
TM.MachineName,
T1.ProductionDate,
First(T1.Picks) As Picks,
First(T1.Placements) As Places,
Sum(T2.Picks) AS CumPicks,
Sum(T2.Placements) AS CumPlaces,
(Sum(T2.Picks) - Sum(T2.Placements))/Sum(T2.Picks) AS CumFail
FROM
((dbo_PickPlaceEntry AS T1
INNER JOIN
dbo_PickPlaceEntry AS T2
ON T1.ComponentRID = T2.ComponentRID
AND T1.MachineID = T2.MachineID)
INNER JOIN dbo_Components AS TC
ON TC.ID = T1.ComponentRID)
INNER JOIN dbo_Machines AS TM
ON TM.ID = T1.MachineID
WHERE
T2.ProductionDate <= T1.ProductionDate
GROUP BY
TC.ComponentName,
TM.MachineName,
T1.ProductionDate;
If that works, you can add another test to the WHERE clause to limit the results to the desired ComponentName or ComponentID and MachineName or
MachineID.
Code:
WHERE T2.ProductionDate <= T1.ProductionDate
AND TC.ComponentName = Forms!MyForm!MyComponentControl
AND TC.MachineName = Forms!MyForm!MyMachineControl