Counting totals lines in Report

L

Larry L

I have a report that gets its data from a query. The query returns ~100
results, in groups of 1-7 records. That means I have ~ 25 groups of data.
In my report I don't want the detail, just the totals, so I leave the
Detail section empty and ask for Sum(0 in the oup Footer. That works
great. However, in the Report Footer I want the total number of groups of
data, (essentially the number of lines on the report) and can't figure out
how to get it? Surely I'm just missing something easy?

TIA,
Larry
 
A

Andre T.

That's indeed a tough question.

The only way I can think of is to create a summary query, one for each of
your detail lines displayed, and then the sum(1) for the grand total. Hope
it helps.

Andre T.
 
D

Dirk Goldgar

Larry L said:
I have a report that gets its data from a query. The query returns
~100 results, in groups of 1-7 records. That means I have ~ 25 groups
of data. In my report I don't want the detail, just the totals, so I
leave the Detail section empty and ask for Sum(0 in the oup Footer.
That works great. However, in the Report Footer I want the total
number of groups of data, (essentially the number of lines on the
report) and can't figure out how to get it? Surely I'm just missing
something easy?

This question really belongs in the <microsoft.public.access.reports>
newsgroup. Anyway, one simple way to do this is to put a text box in
the group header (or footer). Give it these properties:

Name: txtGroupCounter
Control Source: =1
Running Sum: Over All
Visible: No

The size of the text box doesn't matter, because you never intend to
show it.

Now add another text box, this time to the Report Footer, and give it
these properties:

Name: txtTotalGroups
ControlSource: = [txtGroupCounter]
Visible: Yes

This text box will display the total number of groups on the report.
 
M

Marty Suckstorff

-----Original Message-----
I have a report that gets its data from a query. The query returns ~100
results, in groups of 1-7 records. That means I have ~ 25 groups of data.
In my report I don't want the detail, just the totals, so I leave the
Detail section empty and ask for Sum(0 in the oup Footer. That works
great. However, in the Report Footer I want the total number of groups of
data, (essentially the number of lines on the report) and can't figure out
how to get it? Surely I'm just missing something easy?

TIA,
Larry
.
Include a [RecordCounter] text box in your zero height
detail section which sums your records and is reset after
a break.

Any time it is 1, add 1 to a group counter within the
detail section. If other than 1, leave the group counter
as is.

[GroupCounter] = _
IIf([RecordCounter] = 1, [GroupCounter] + 1,
[GroupCounter])

So the group counter only increases when the record
counter is 1, which only occurs when there is a new
section.

Hope this helps. Best of Luck!
 
L

Larry L

-----Original Message-----
I have a report that gets its data from a query. The query returns ~100
results, in groups of 1-7 records. That means I have ~ 25 groups of data.
In my report I don't want the detail, just the totals, so I leave the
Detail section empty and ask for Sum(0 in the oup Footer. That works
great. However, in the Report Footer I want the total number of groups of
data, (essentially the number of lines on the report) and can't figure out
how to get it? Surely I'm just missing something easy?

TIA,
Larry
.
Include a [RecordCounter] text box in your zero height
detail section which sums your records and is reset after
a break.

Any time it is 1, add 1 to a group counter within the
detail section. If other than 1, leave the group counter
as is.

[GroupCounter] = _
IIf([RecordCounter] = 1, [GroupCounter] + 1,
[GroupCounter])

So the group counter only increases when the record
counter is 1, which only occurs when there is a new
section.

Hope this helps. Best of Luck!

Marty,

Very creative. It also led me to a solution for another problem on
another report I have!

Thanks much,
Larry L [in Honolulu]
 
L

Larry L

Larry L said:
I have a report that gets its data from a query. The query returns
~100 results, in groups of 1-7 records. That means I have ~ 25 groups
of data. In my report I don't want the detail, just the totals, so I
leave the Detail section empty and ask for Sum(0 in the oup Footer.
That works great. However, in the Report Footer I want the total
number of groups of data, (essentially the number of lines on the
report) and can't figure out how to get it? Surely I'm just missing
something easy?

This question really belongs in the <microsoft.public.access.reports>
newsgroup. Anyway, one simple way to do this is to put a text box in
the group header (or footer). Give it these properties:

Name: txtGroupCounter
Control Source: =1
Running Sum: Over All
Visible: No

The size of the text box doesn't matter, because you never intend to
show it.

Now add another text box, this time to the Report Footer, and give it
these properties:

Name: txtTotalGroups
ControlSource: = [txtGroupCounter]
Visible: Yes

This text box will display the total number of groups on the report.

Dirk,

Thanks much, that worked great. (I didn't even know there was a Reports
group, so thanks for that too.

Larry L [in Honolulu]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top