Count value in combo box if = to ...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report I am trying to run for a pet shelter. I have a combo box for
type of pet (i.e. cat, dog, reptile) in the report I need to be able to count
how many cats, how many dogs, and how many reptiles. However I have not found
a way to do this. I tried =countif("Cat") however that did not work.
Anyone have any suggestions?

Thank you
 
Michael said:
I have a report I am trying to run for a pet shelter. I have a combo box for
type of pet (i.e. cat, dog, reptile) in the report I need to be able to count
how many cats, how many dogs, and how many reptiles. However I have not found
a way to do this. I tried =countif("Cat") however that did not work.


An Access expression to do that is:
=Abs(Sum([pettypefield] = "Cat"))

But you will be better off using a subreport based on a
Totals type query (that is in turn based on the report's
record source query). This way, if you should ever change
the list of pet types (e.g. bird), you will not have to go
back and modify your report.
 
Thank you for your assistance. I will set up the report & query based on your
suggestions.

Have a great day

Marshall Barton said:
Michael said:
I have a report I am trying to run for a pet shelter. I have a combo box for
type of pet (i.e. cat, dog, reptile) in the report I need to be able to count
how many cats, how many dogs, and how many reptiles. However I have not found
a way to do this. I tried =countif("Cat") however that did not work.


An Access expression to do that is:
=Abs(Sum([pettypefield] = "Cat"))

But you will be better off using a subreport based on a
Totals type query (that is in turn based on the report's
record source query). This way, if you should ever change
the list of pet types (e.g. bird), you will not have to go
back and modify your report.
 
Back
Top