Report Records is being loop twice

ezfriend

Registered User.
Local time
Yesterday, 23:30
Joined
Nov 24, 2006
Messages
242
My report record source is set to one of the query that I created.

For some reason, when I run the report, the records are being cycle twice which makes my total double what it is suppose to be.

The records consist of

Employee Number
Number of Hours

Total Hours (for all employees)

Each employee hours is added to a variable and display at the end.

-Chai.
 
Last edited:
What is the SQL of the query? I suspect you may not have a join that should be there.
 
Here is the SQL

SELECT tblEmployee.EMPLOYEENO, Sum(tblEmployeeHour.NUMHOURS) AS TotalHours
FROM tblEmployee INNER JOIN tblEmployeeHour ON tblEmployee.EMPLOYEENO = tblEmployeeHour.EMPLOYEENO
GROUP BY tblEmployee.EMPLOYEENO;

The results is correct, but when run with the report, it is being loop through twice so the total is doubled.
 
If that is the is the recordsource of the report, it isn't being "looped through twice." A report doesn't loop through it's recordsource. It displays what you tell it to, so the next question is what does this mean:

Each employee hours is added to a variable and display at the end.

You don't need to add the hours to a variable. In fact, you don't even need the query to do the hours calculation either.

All you need to do is to group the report on the EmployeeNO and make sure that there is a group footer and then put =Sum([NUMHOURS]) in the group footer. It will sum the total hours for the employee. And, if you set the detail section's Visible property to NO then you won't get all of the separate entries per day for each employee.

If you still have a problem, see if you can post what you have (changing the names of course) and we can take a look.
 

Users who are viewing this thread

Back
Top Bottom