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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sum a count total



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2010, 01:39 PM posted to microsoft.public.access.queries
glenn
external usenet poster
 
Posts: 216
Default Sum a count total

Hi,

I have a query that shows the following information

It looks at a specific table (table 1) then groups by sales agent, then
groups the tariffs that have been sold by that sales agent and then the query
has a count on tariffs. I have then built a report to display the results
which would look like this :-

Dave Brown
Standard Tariff 1
EDP Tariff 2

What I want is a nother function in the query that will then sum the count
coloumn so the example above the sum coloumn would be 3. i then need the
report to sort by the sum.

Thanks

  #2  
Old April 28th, 2010, 03:25 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default (SELECT

Glenn wrote:
I have a query that shows the following information

It looks at a specific table (table 1) then groups by sales agent, then
groups the tariffs that have been sold by that sales agent and then the query
has a count on tariffs. I have then built a report to display the results
which would look like this :-

Dave Brown
Standard Tariff 1
EDP Tariff 2

What I want is a nother function in the query that will then sum the count
coloumn so the example above the sum coloumn would be 3. i then need the
report to sort by the sum.


You can use a subquery to do that. Add a calculated field
to your query that looks something like:

(SELECT COUNT(*) FROM )Table1 As X WHERE X.agent =
Table1.agent) AS AgentTariffs

Set this field's Group By cell to Expression

--
Marsh
MVP [MS Access]
  #3  
Old April 28th, 2010, 03:35 PM posted to microsoft.public.access.queries
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Sum a count total

On Wed, 28 Apr 2010 05:39:01 -0700, Glenn
wrote:

I would create that sum total in the report footer, not in the query.
Create a field in the footer and set the ControlSource to:
=sum(myCountOfTariff)
(of course you replace myObjectNames with yours)

-Tom.
Microsoft Access MVP


Hi,

I have a query that shows the following information

It looks at a specific table (table 1) then groups by sales agent, then
groups the tariffs that have been sold by that sales agent and then the query
has a count on tariffs. I have then built a report to display the results
which would look like this :-

Dave Brown
Standard Tariff 1
EDP Tariff 2

What I want is a nother function in the query that will then sum the count
coloumn so the example above the sum coloumn would be 3. i then need the
report to sort by the sum.

Thanks

  #4  
Old April 28th, 2010, 05:22 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Sum a count total

Tom, I suspect that you missed the last part of Glen's
objective?
--
Marsh
MVP [MS Access]


Tom van Stiphout wrote:
I would create that sum total in the report footer, not in
the query.
[snip]

Glenn wrote:

[snip]
i then need the report to sort by the sum.

  #5  
Old April 29th, 2010, 02:38 AM posted to microsoft.public.access.queries
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default (SELECT

IIRC, there are situations where a report will not sort on a value derived
from a subquery. If this happens, you may need to create a totals query and
join it to your report's recordsource query.

--
Duane Hookom
MS Access MVP


"Marshall Barton" wrote in message
...
Glenn wrote:
I have a query that shows the following information

It looks at a specific table (table 1) then groups by sales agent, then
groups the tariffs that have been sold by that sales agent and then the
query
has a count on tariffs. I have then built a report to display the results
which would look like this :-

Dave Brown
Standard Tariff 1
EDP Tariff 2

What I want is a nother function in the query that will then sum the count
coloumn so the example above the sum coloumn would be 3. i then need the
report to sort by the sum.


You can use a subquery to do that. Add a calculated field
to your query that looks something like:

(SELECT COUNT(*) FROM )Table1 As X WHERE X.agent =
Table1.agent) AS AgentTariffs

Set this field's Group By cell to Expression

--
Marsh
MVP [MS Access]


 




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 10:52 PM.


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