I was going to ask you about that HAVING. Having is used to filter aggregate items, not row items, so doesn't seem necessary here. I think
should be sufficient.PARAMETERS lEmpID Long, dtFrom DateTime, dtTo DateTime; SELECT TP.empID, SUM(DateDiff("n",[dtTimeIn],[dtTimeOut])/60) AS Hours FROM tblTimePairs As TP WHERE (TP.dtWork BETWEEN [dtFrom] AND [dtTo]) AND (TP.empID=[lEmpID]) GROUP BY TP.empID ;
BTW, it is convention to use upper-case for keywords.




Reply With Quote