J
JHeide58
I have a custom query (built thru the DRW) that filters returned expense items by date range. I've added a totaling function that prints subtotals for each employee. Problem is that the subtotaling returns a subtotal for the entire database, not filtered by the date range. The returned DRW page shows the filtered individual items but gives a total for each employee for all records. Can someone help me sort out this mess?
Thanks.
see code below
SELECT qry_Results_w_Total_test1.Employee_Name, qry_Results_w_Total_test1.Timestamp1,qry_Results_w_Total_test1.Expr2,
Format(Timestamp1, 'mm/dd/yy') as fTimestamp1,
Format(Expr2, '$0.00') as fExpr2,
Format(TotalPerDiem,'$0.00') as fTotalPerDiem,
(SELECT Sum(Expr2) From qry_Results_w_Total_test1 AS Results_1 WHERE Results_1.Employee_Name = qry_Results_w_Total_test1.Employee_Name) AS TotalPerDiem, (SELECT Count(Expr2) From qry_Results_w_Total_test1 AS Results_1 WHERE Results_1.Employee_Name = qry_Results_w_Total_test1.Employee_Name) AS Count FROM qry_Results_w_Total_test1
WHERE (Timestamp1 >= '::Timestamp2::' AND Timestamp1 <= '::Timestamp3::')
ORDER by Employee_Name ASC;
Thanks.
see code below
SELECT qry_Results_w_Total_test1.Employee_Name, qry_Results_w_Total_test1.Timestamp1,qry_Results_w_Total_test1.Expr2,
Format(Timestamp1, 'mm/dd/yy') as fTimestamp1,
Format(Expr2, '$0.00') as fExpr2,
Format(TotalPerDiem,'$0.00') as fTotalPerDiem,
(SELECT Sum(Expr2) From qry_Results_w_Total_test1 AS Results_1 WHERE Results_1.Employee_Name = qry_Results_w_Total_test1.Employee_Name) AS TotalPerDiem, (SELECT Count(Expr2) From qry_Results_w_Total_test1 AS Results_1 WHERE Results_1.Employee_Name = qry_Results_w_Total_test1.Employee_Name) AS Count FROM qry_Results_w_Total_test1
WHERE (Timestamp1 >= '::Timestamp2::' AND Timestamp1 <= '::Timestamp3::')
ORDER by Employee_Name ASC;