Sum of two Counts

DaveG

New member
Local time
Today, 18:47
Joined
Mar 30, 2011
Messages
8
Hi all,

I'm trying to add the results together of two counts.

My report has field for Attendance and within that field there are three possible options, Attended, Cancelled and DNA. For reporting purposes I need to have a total figure for Attended and one for DNA's, then one further that adds those two together to give total.

Have created on the report Header Text Box with Control Source of:

TextBox Name: AttendedTotal
Code:
=Count(IIf([Attendance]="Attended",0))
TextBox Name: DNAtotal
Code:
=Count(IIf([Attendance]="DNA",0))

This gives correct count for those two fields, my problem has been adding the two results together within another text box called: SlotsUsed

Any guidance/help would be most grateful

Cheers
Dave
 
In the Control Source of SlotsUsed, type in = [AttendedTotal] + [DNAtotal]

Remember to click somewhere else after typing those and save before you run it.
 
In the Control Source of SlotsUsed, type in = [AttendedTotal] + [DNAtotal]

Remember to click somewhere else after typing those and save before you run it.

Sorry DentTrec, you can't do that on a report. You need to use the full calculation:


=Count(IIf([Attendance]="Attended",0)) + Count(IIf([Attendance]="DNA",0))
 
Thanks DentTec for reply, sometimes you just need that voice of reason. Did try something like that before but I kept trying =SUM[ rather than =[

Cheers again
Dave
 
Sorry DentTrec, you can't do that on a report. You need to use the full calculation:

=Count(IIf([Attendance]="Attended",0)) + Count(IIf([Attendance]="DNA",0))

Thanks also Bob, that works also, both replies are producing the same end result :-)
 
Okay, if the controls are not bound to a field then you can probably refer to them but if they are you can't refer to the controls with formulas which refer to bound fields.
 
All understood Bob, thanks for the extra info.
 

Users who are viewing this thread

Back
Top Bottom