473,466 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Report Group Footer not displaying the total that I want

Greetings. I have a report based on the following query (hang in there
... it's quite long):

SELECT Year([tblEvents].[eventstartdt]) AS Yr, tblEvents.eventID,
tblEvents.eventname, tblEvents.eventhost, tblEvents.eventcity,
tblEvents.eventstate, tblEvents.eventstartdt, tblEvents.eventenddt,
tblTrials.trialnbr, tblTrials.trialdt, tblTrialClass.trialclassID,
tblClasses.class, tblScores.score, tblScores.level, [tblPeople].[fname]
& (" "+[tblPeople].[midinit]+".") & " " & [tblPeople].[lname] & ("
"+[tblPeople].[suffix]+".") & " (" & [tblPeople].[city] & ", " &
[tblPeople].[state] & ")" AS judge, tblScores.qualified
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.eventID =
tblTrials.eventID) INNER JOIN (((tblPeople INNER JOIN tblJudges ON
tblPeople.peopleID = tblJudges.peopleID) INNER JOIN (tblClasses INNER
JOIN tblTrialClass ON tblClasses.classID = tblTrialClass.classID) ON
tblJudges.judgeID = tblTrialClass.judgeID) INNER JOIN tblScores ON
tblTrialClass.trialclassID = tblScores.trialclassID) ON
tblTrials.trialID = tblTrialClass.trialID
ORDER BY Year([tblEvents].[eventstartdt]), tblEvents.eventstartdt,
tblTrials.trialnbr, tblClasses.classID, tblScores.level;
The report is sorted (ascending) and grouped by:
Yr
eventstartdt
eventname
trialnbr
class

There can be many events in a yr
there can be many trials in an event
there can be three classes in a trial

I want to display the following in the Yr Footer (year end totals):

# of Events
# of Trials (total)
Avg # of Trials in an Event
Max # of Trials in an Event

The problem: each record in the recordset is basically a "score" that
was recorded for a dog competing in a trial which is in an event. So
there are many records with the same eventname/eventID. For my test data
the number of records is 32. When I used =Count([eventID]) for the
ControlSource of the textbox for "# of Events" (in the Yr Footer) the
result was 32 instead of 2 (there are 2 events in my test data).

What I really want is something like =Count(distinct [eventID]) but that
is not a valid construct. Any ideas how to get the results I want in
this report? Or do I need a different report (i.e.; a different query)?

Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
7 3401
One option is to use the built in running sum property (data tab) of a
textbox when it is on a report. To get a count, you can set the Control
Source of the textbox to =1 and set its Running Sum property to Over All or
Over Group. If you want to count only if the value of another field is a
certain value, you can use an IIf statement instead of =1, such as
=IIf([txtOtherTextbox]="Hello", 1, 0). This will count the number of records
that have Hello in txtOtherTextbox. In the group footer, place a textbox
with its Control Source pointing to the summing textbox in the detail
section

=txtMySummingTextbox

--
Wayne Morgan
MS Access MVP
"SueB" <sl*****@verizon.net> wrote in message
news:lN************@news.uswest.net...
Greetings. I have a report based on the following query (hang in there
.. it's quite long):

SELECT Year([tblEvents].[eventstartdt]) AS Yr, tblEvents.eventID,
tblEvents.eventname, tblEvents.eventhost, tblEvents.eventcity,
tblEvents.eventstate, tblEvents.eventstartdt, tblEvents.eventenddt,
tblTrials.trialnbr, tblTrials.trialdt, tblTrialClass.trialclassID,
tblClasses.class, tblScores.score, tblScores.level, [tblPeople].[fname]
& (" "+[tblPeople].[midinit]+".") & " " & [tblPeople].[lname] & ("
"+[tblPeople].[suffix]+".") & " (" & [tblPeople].[city] & ", " &
[tblPeople].[state] & ")" AS judge, tblScores.qualified
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.eventID =
tblTrials.eventID) INNER JOIN (((tblPeople INNER JOIN tblJudges ON
tblPeople.peopleID = tblJudges.peopleID) INNER JOIN (tblClasses INNER
JOIN tblTrialClass ON tblClasses.classID = tblTrialClass.classID) ON
tblJudges.judgeID = tblTrialClass.judgeID) INNER JOIN tblScores ON
tblTrialClass.trialclassID = tblScores.trialclassID) ON
tblTrials.trialID = tblTrialClass.trialID
ORDER BY Year([tblEvents].[eventstartdt]), tblEvents.eventstartdt,
tblTrials.trialnbr, tblClasses.classID, tblScores.level;
The report is sorted (ascending) and grouped by:
Yr
eventstartdt
eventname
trialnbr
class

There can be many events in a yr
there can be many trials in an event
there can be three classes in a trial

I want to display the following in the Yr Footer (year end totals):

# of Events
# of Trials (total)
Avg # of Trials in an Event
Max # of Trials in an Event

The problem: each record in the recordset is basically a "score" that
was recorded for a dog competing in a trial which is in an event. So
there are many records with the same eventname/eventID. For my test data
the number of records is 32. When I used =Count([eventID]) for the
ControlSource of the textbox for "# of Events" (in the Yr Footer) the
result was 32 instead of 2 (there are 2 events in my test data).

What I really want is something like =Count(distinct [eventID]) but that
is not a valid construct. Any ideas how to get the results I want in
this report? Or do I need a different report (i.e.; a different query)?

Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #2
Wayne,
Thanks for the suggestion. I did, however, try the Running Sum by
defining a textbox in the EventName group header section. I printed the
value in the Event header and the number printed correctly. However,
when I tried to reference that control by name in the Yr Footer Section,
it would not work.

I don't think I would want to put that counter field in the Detail
Section because it would count every record, wouldn't it. That would
give me 32 (the total number of score records).

And your other option ... =IIf([txtOtherTextbox]="Hello", 1, 0) ...
actually I don't think that this will work, because I don't know what
constant I would be comparing to. I want to count the number of events.
Their unique value is only known during processing (eventname or
eventID). If I could reference the other fields in the Yr Section
Footer that would be ok, but I can't.

Please correct my thinking if I am wrong. Obviously I am wrong about
something because I don't have the results I want. So...please fire
away. Thanks.

Sue

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
SueB wrote:
Greetings. I have a report based on the following query (hang in there
.. it's quite long):

SELECT Year([tblEvents].[eventstartdt]) AS Yr, tblEvents.eventID,
tblEvents.eventname, tblEvents.eventhost, tblEvents.eventcity,
tblEvents.eventstate, tblEvents.eventstartdt, tblEvents.eventenddt,
tblTrials.trialnbr, tblTrials.trialdt, tblTrialClass.trialclassID,
tblClasses.class, tblScores.score, tblScores.level, [tblPeople].[fname]
& (" "+[tblPeople].[midinit]+".") & " " & [tblPeople].[lname] & ("
"+[tblPeople].[suffix]+".") & " (" & [tblPeople].[city] & ", " &
[tblPeople].[state] & ")" AS judge, tblScores.qualified
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.eventID =
tblTrials.eventID) INNER JOIN (((tblPeople INNER JOIN tblJudges ON
tblPeople.peopleID = tblJudges.peopleID) INNER JOIN (tblClasses INNER
JOIN tblTrialClass ON tblClasses.classID = tblTrialClass.classID) ON
tblJudges.judgeID = tblTrialClass.judgeID) INNER JOIN tblScores ON
tblTrialClass.trialclassID = tblScores.trialclassID) ON
tblTrials.trialID = tblTrialClass.trialID
ORDER BY Year([tblEvents].[eventstartdt]), tblEvents.eventstartdt,
tblTrials.trialnbr, tblClasses.classID, tblScores.level;
The report is sorted (ascending) and grouped by:
Yr
eventstartdt
eventname
trialnbr
class

There can be many events in a yr
there can be many trials in an event
there can be three classes in a trial

I want to display the following in the Yr Footer (year end totals):

# of Events
# of Trials (total)
Avg # of Trials in an Event
Max # of Trials in an Event

The problem: each record in the recordset is basically a "score" that
was recorded for a dog competing in a trial which is in an event. So
there are many records with the same eventname/eventID. For my test data
the number of records is 32. When I used =Count([eventID]) for the
ControlSource of the textbox for "# of Events" (in the Yr Footer) the
result was 32 instead of 2 (there are 2 events in my test data).

What I really want is something like =Count(distinct [eventID]) but that
is not a valid construct. Any ideas how to get the results I want in
this report? Or do I need a different report (i.e.; a different query)?

Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***


What happens if you create a field called EventCounter with a control
source of =1 in the event header or footer. Then get a running sum of
EventCounter in the Yr footer.
Nov 13 '05 #4
Salad,

I must be missing something. Because I keep getting a popup dialog box
asking me for the parameter value for [eventcounter].

I put a textbox in Event Header Section. ControlSource=1 with
RunningSum=Over All (I also tried with RunningSum=Over Group). Then I
put a textbox in Yr Footer Section with
ControlSource=sum([eventcounter]). That did not work. Then I changed
the ControlSource to =sum(me![eventcounter]). That did not work. I
tried ControlSource=Count([eventcounter]) and =Count(me![eventcounter]).
They all did not work. That's because it does not recognize the
controlname.

Any other thoughts?
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
SueB wrote:
Salad,

I must be missing something. Because I keep getting a popup dialog box
asking me for the parameter value for [eventcounter].

I put a textbox in Event Header Section. ControlSource=1 with
RunningSum=Over All (I also tried with RunningSum=Over Group). Then I
put a textbox in Yr Footer Section with
ControlSource=sum([eventcounter]). That did not work. Then I changed
the ControlSource to =sum(me![eventcounter]). That did not work. I
tried ControlSource=Count([eventcounter]) and =Count(me![eventcounter]).
They all did not work. That's because it does not recognize the
controlname.

Any other thoughts?
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***


Hmmm. If I created a field called EventCounter and I made it a running
sum with a control source of =1 I might create a field called EventCount
with a control source of =[EventCounter] in the footer band.

Nov 13 '05 #6
Ok ... it's the simple approach that usually wins. THAT DID IT. Thanks
so much.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #7
Is the control name and, if it's a bound control, its field name the same?
If so, when you try to reference that control by name you'll get a #Name
error. If that is the case, change the name of the control. If it's a
textbox, you can just put txtNameOfControl, just something to make it
different.

--
Wayne Morgan
MS Access MVP
"SueB" <sl*****@verizon.net> wrote in message
news:e_**************@news.uswest.net...
Wayne,
Thanks for the suggestion. I did, however, try the Running Sum by
defining a textbox in the EventName group header section. I printed the
value in the Event header and the number printed correctly. However,
when I tried to reference that control by name in the Yr Footer Section,
it would not work.

I don't think I would want to put that counter field in the Detail
Section because it would count every record, wouldn't it. That would
give me 32 (the total number of score records).

And your other option ... =IIf([txtOtherTextbox]="Hello", 1, 0) ...
actually I don't think that this will work, because I don't know what
constant I would be comparing to. I want to count the number of events.
Their unique value is only known during processing (eventname or
eventID). If I could reference the other fields in the Yr Section
Footer that would be ok, but I can't.

Please correct my thinking if I am wrong. Obviously I am wrong about
something because I don't have the results I want. So...please fire
away. Thanks.

Sue

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shiz | last post by:
I currently have a Form with Option buttons (to give you the option of sorting by name, or by Field, etc), these are referenced in a module which then formats the report contingent on the option...
3
by: Susan Bricker | last post by:
I have a group section footer in a Report in which I want to display various "counts" (not sums). For example: some of the fields in the recordset from the query are: score = integer qualified...
7
by: Darin | last post by:
I have a report that sub-totals on a group, then grand-totals at the report footer. If there's only one group, the sub-total and grand total are redundant, so I only want to show one of them. I...
1
by: cityrock | last post by:
Hi everyone, I have been searching 3 days stright for an answer, with no luck, so I decided to ask it out loud myself. Here is my problem. I am using a report as a catalog for my company. The...
1
by: David Horowitz | last post by:
Hi folks. I need to create a report that has a Group Header that pulls certain data from the Detail section. It's something like this: +--Report---------------------------------------- |...
3
by: gardner | last post by:
Please help. I am trying to count something in a Group Footer using a Text Box. If what I am doing is not doable, or there is a better way to structure this please tell me. Here is the situation:...
1
by: PDH | last post by:
I have sumation in my group footer that I would like to hide when the sumation = zero. I am relatively new to MS access and my current attempt involved the onformat and the following expression: ...
4
by: DavidB | last post by:
Im not sure if I am missing something obvious here or not so excuse me if this is a DFU question please... I have a report I am working on that includes the following data. Agency Name Vendor...
3
by: carmela_wong | last post by:
I am trying to output a report in which I show the total number of people if groupfooter is "STAFF" but not if it is "ATTENDEES". The report will say: STAFF: Staff1....... Staff2...... Total...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.