fat controller
Slightly round the bend..
- Local time
- Today, 01:28
- Joined
- Apr 14, 2011
- Messages
- 758
Happy New Year to you all 
I have designed a very small sub report, the intention of which is to give a total number of complaints lodged against each individual employee in a specified timeframe, however I am getting something wrong somewhere and I cannot for the life of me get my head around it.
Here is the SQL so far:
When I run the sub-report, it does return a number of records, but lists them all individually - for example, it will show:
5501112 - 1
5509448 - 1
5509448 - 1
5509448 - 1
5509448 - 1
5078898 - 1
Whereas I would like it to return:
5501112 - 1
5509448 - 4
5078898 - 1
Any idea where I am going wrong?
I have designed a very small sub report, the intention of which is to give a total number of complaints lodged against each individual employee in a specified timeframe, however I am getting something wrong somewhere and I cannot for the life of me get my head around it.
Here is the SQL so far:
Code:
SELECT PublicComplaints.EmployeeNumber, Count(PublicComplaints.EmployeeNumber) AS “NumberOfComplaints”
FROM PublicComplaints
WHERE (((PublicComplaints.DateProcessed) Between [Forms]![DateSelect]![txtStartDate] And [Forms]![DateSelect]![txtEndDate]))
GROUP BY PublicComplaints.EmployeeNumber, PublicComplaints.ID
HAVING (((Count(PublicComplaints.EmployeeNumber))>0))
ORDER BY Count(PublicComplaints.EmployeeNumber) DESC;
When I run the sub-report, it does return a number of records, but lists them all individually - for example, it will show:
5501112 - 1
5509448 - 1
5509448 - 1
5509448 - 1
5509448 - 1
5078898 - 1
Whereas I would like it to return:
5501112 - 1
5509448 - 4
5078898 - 1
Any idea where I am going wrong?