Trying to Count in a Report

  • Thread starter Thread starter TraciAnn
  • Start date Start date
T

TraciAnn

In a report that is grouping first on Date by Day then on Event, I am trying
to count each different event.

To do this I created an unbound text box for each event in the Detail
section with expression:
=IIf([Event]="EventName",1,0) Naming the textbox txtEventName (where
"EventName" is the name of each event)

In the Event footer I placed unbound text boxes for each event using the
expression:
=Sum([txtEventName]) Naming each of these text boxes txtDailyEventName and
setting the Running Sum to "Over Group".

The IIf statement in Detail is working as expected, giving either a 1 or 0
based on the name of the event. But the Sum in the group footer isn't
working. When I run the report I get asked [EventName] as a parameter for
each text box I have in the Detail field. And the value displays as "0".

Please Help!
 
Hello TraciAnn,

I think that your problem is trying to utilize the result of the calculation
via a variable name in your aggregate calculation.

Trying replacing your final one with =Sum(IIf([Event]="EventName",1,0))
 
It all starts with the data...

Any chance your field [Event] is defined in the underlying table as a
"lookup" data type? (you don't mention which version of Access you are
trying to do this in...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
That was it Fred!!!

Thanks much!
--
TraciAnn


Fred said:
Hello TraciAnn,

I think that your problem is trying to utilize the result of the calculation
via a variable name in your aggregate calculation.

Trying replacing your final one with =Sum(IIf([Event]="EventName",1,0))

TraciAnn said:
In a report that is grouping first on Date by Day then on Event, I am trying
to count each different event.

To do this I created an unbound text box for each event in the Detail
section with expression:
=IIf([Event]="EventName",1,0) Naming the textbox txtEventName (where
"EventName" is the name of each event)

In the Event footer I placed unbound text boxes for each event using the
expression:
=Sum([txtEventName]) Naming each of these text boxes txtDailyEventName and
setting the Running Sum to "Over Group".

The IIf statement in Detail is working as expected, giving either a 1 or 0
based on the name of the event. But the Sum in the group footer isn't
working. When I run the report I get asked [EventName] as a parameter for
each text box I have in the Detail field. And the value displays as "0".

Please Help!
 
Back
Top