A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sort by calculated field



 
 
Thread Tools Display Modes
  #1  
Old January 16th, 2009, 07:32 PM posted to microsoft.public.access.reports
EMess
external usenet poster
 
Posts: 1
Default Sort by calculated field

I have a report that lists the Incidents for each member of our company. The
SQL for the report is

SELECT tblIncidents.IncidentNumber, tblIncidents.IncidentDate, tblMembers.
MemberNumber, tblMembers.MemberLName, tblMembers.MemberFName, tblMembers.
MemberID
FROM tblMembers INNER JOIN (tblIncidents INNER JOIN tjxMemberIncidents ON
tblIncidents.IncidentID = tjxMemberIncidents.IncidentID) ON tblMembers.
MemberID = tjxMemberIncidents.MemberID
WHERE (((tblIncidents.IncidentDate) Between [Enter Start Date] And [Enter End
Date]));

I have another field on the report that was created using:

=Count(tblIncidents!IncidentNumber)

I want to sort on that county but I understand I cannot. So, following some
posts on this board, I created a query that is:
SELECT tblIncidents.IncidentId, Count(*) AS TotalInc
FROM tblIncidents
GROUP BY tblIncidents.incidentid;

and tried to incorpoate that into my report as part of the record source.
But I just cannot get it to work despite all my efforts. I am new to all of
this and very confused. Your hlep is appreciated.

  #2  
Old January 17th, 2009, 03:25 AM posted to microsoft.public.access.reports
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default Sort by calculated field

Hi,

How are your grouping and sorting your report? In what part of the
report is the =Count(tblIncidents!IncidentNumber) text box? It looks like
the second query counts on a per-incident basis, not a per-member basis. Is
that what you want? What is the difference between IncidentNumber and
IncidentID? Do they both uniquely identify the same incident? If so, it may
make sense to get rid on one of them and only have one value. Do you want
the counts to be limited to the date range or to be over all time?

Clifford Bass

"EMess" wrote:

I have a report that lists the Incidents for each member of our company. The
SQL for the report is

SELECT tblIncidents.IncidentNumber, tblIncidents.IncidentDate, tblMembers.
MemberNumber, tblMembers.MemberLName, tblMembers.MemberFName, tblMembers.
MemberID
FROM tblMembers INNER JOIN (tblIncidents INNER JOIN tjxMemberIncidents ON
tblIncidents.IncidentID = tjxMemberIncidents.IncidentID) ON tblMembers.
MemberID = tjxMemberIncidents.MemberID
WHERE (((tblIncidents.IncidentDate) Between [Enter Start Date] And [Enter End
Date]));

I have another field on the report that was created using:

=Count(tblIncidents!IncidentNumber)

I want to sort on that county but I understand I cannot. So, following some
posts on this board, I created a query that is:
SELECT tblIncidents.IncidentId, Count(*) AS TotalInc
FROM tblIncidents
GROUP BY tblIncidents.incidentid;

and tried to incorpoate that into my report as part of the record source.
But I just cannot get it to work despite all my efforts. I am new to all of
this and very confused. Your hlep is appreciated.

  #3  
Old January 17th, 2009, 05:02 AM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Sort by calculated field

Don't you want to sort by the count grouped by member? Your totals query
count members by incident. I would think you want:
SELECT MemberID, Count(*) As NumOf
FROM tjxMemberIncidents
GROUP BY MemberID;

Then add this totals query to your report's record source and join the
MemberID fields. You should then be able to sort/group by NumOf.

--
Duane Hookom
Microsoft Access MVP


"EMess" wrote:

I have a report that lists the Incidents for each member of our company. The
SQL for the report is

SELECT tblIncidents.IncidentNumber, tblIncidents.IncidentDate, tblMembers.
MemberNumber, tblMembers.MemberLName, tblMembers.MemberFName, tblMembers.
MemberID
FROM tblMembers INNER JOIN (tblIncidents INNER JOIN tjxMemberIncidents ON
tblIncidents.IncidentID = tjxMemberIncidents.IncidentID) ON tblMembers.
MemberID = tjxMemberIncidents.MemberID
WHERE (((tblIncidents.IncidentDate) Between [Enter Start Date] And [Enter End
Date]));

I have another field on the report that was created using:

=Count(tblIncidents!IncidentNumber)

I want to sort on that county but I understand I cannot. So, following some
posts on this board, I created a query that is:
SELECT tblIncidents.IncidentId, Count(*) AS TotalInc
FROM tblIncidents
GROUP BY tblIncidents.incidentid;

and tried to incorpoate that into my report as part of the record source.
But I just cannot get it to work despite all my efforts. I am new to all of
this and very confused. Your hlep is appreciated.


  #4  
Old January 17th, 2009, 03:29 PM posted to microsoft.public.access.reports
EMess via AccessMonster.com
external usenet poster
 
Posts: 1
Default Sort by calculated field

What I am trying to do is count the number of incidents each member has.
Then, I am reporting that number for each member. I want those members with
the most incididents to come out first. The Group by Incident ID was just
something I was trying.

Duane Hookom wrote:
Don't you want to sort by the count grouped by member? Your totals query
count members by incident. I would think you want:
SELECT MemberID, Count(*) As NumOf
FROM tjxMemberIncidents
GROUP BY MemberID;

Then add this totals query to your report's record source and join the
MemberID fields. You should then be able to sort/group by NumOf.

I have a report that lists the Incidents for each member of our company. The
SQL for the report is

[quoted text clipped - 21 lines]
But I just cannot get it to work despite all my efforts. I am new to all of
this and very confused. Your hlep is appreciated.


--
Message posted via http://www.accessmonster.com

  #5  
Old January 17th, 2009, 04:34 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Sort by calculated field

Did you try the solution I suggested?
If you want a count per member, then you must group by member.

--
Duane Hookom
Microsoft Access MVP


"EMess via AccessMonster.com" wrote:

What I am trying to do is count the number of incidents each member has.
Then, I am reporting that number for each member. I want those members with
the most incididents to come out first. The Group by Incident ID was just
something I was trying.

Duane Hookom wrote:
Don't you want to sort by the count grouped by member? Your totals query
count members by incident. I would think you want:
SELECT MemberID, Count(*) As NumOf
FROM tjxMemberIncidents
GROUP BY MemberID;

Then add this totals query to your report's record source and join the
MemberID fields. You should then be able to sort/group by NumOf.

I have a report that lists the Incidents for each member of our company. The
SQL for the report is

[quoted text clipped - 21 lines]
But I just cannot get it to work despite all my efforts. I am new to all of
this and very confused. Your hlep is appreciated.


--
Message posted via http://www.accessmonster.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.