Calculated control on a report

D

Duane

Is it possible to have a control(s) in the footer that will count a field.

Example:

I have a field called REP's. It is either a YES or NO. Can one control
count the number or YES' and a second control count the NO's?

I have tried to find and example of this but haven't had any luck. Any help
would be greatly appreciated.
 
J

John Vinson

Is it possible to have a control(s) in the footer that will count a field.

Example:

I have a field called REP's. It is either a YES or NO. Can one control
count the number or YES' and a second control count the NO's?

I have tried to find and example of this but haven't had any luck. Any help
would be greatly appreciated.

Yes... but you'll need another field in the Query upon which the
report is based. Assuming that REP is a Text field (I hope the
fieldname doesn't contain an apostrophe!!!), put two calculated fields
in the query:

IsYes: -([REP] = "Yes")
IsNo: -([REP] = "No")

These values will be 1 if the equality is true (True is stored as -1),
0 if false.

You can then put a textbox on your report with a control source

=Sum([IsYes])

etc.

John W. Vinson[MVP]
 
D

Duane

Thanks John. That was exactly what I was looking for.


John Vinson said:
Is it possible to have a control(s) in the footer that will count a field.

Example:

I have a field called REP's. It is either a YES or NO. Can one control
count the number or YES' and a second control count the NO's?

I have tried to find and example of this but haven't had any luck. Any
help
would be greatly appreciated.

Yes... but you'll need another field in the Query upon which the
report is based. Assuming that REP is a Text field (I hope the
fieldname doesn't contain an apostrophe!!!), put two calculated fields
in the query:

IsYes: -([REP] = "Yes")
IsNo: -([REP] = "No")

These values will be 1 if the equality is true (True is stored as -1),
0 if false.

You can then put a textbox on your report with a control source

=Sum([IsYes])

etc.

John W. Vinson[MVP]
 
Top