Male Female Count

G

Guest

Is there a way to calculate (count female and male clients) at the end of a
report based on whether they put male or female in the record. For example:

Santa Clause Male
Easter Bunny Female
Tooth Fairy Female
Frosty Snowman Male

I know how to do a group by query and count function but was hoping not to
have a query and then subrpt.
 
M

Michel Walsh

A DCount with the appropriate criteria, or a SUM, relaying on the fact that
true = -1 and false = 0:


=SUM( iif(sex="Male", 1, 0 )) and =SUM( iif( sex="Female",
1, 0 ))


or

= - SUM( sex="Male" ) and = - SUM( sex="Female" )





That assumes your field, sex, is a string and contains either the value Male
either the value Female. It may be that you use Lookup, and while it shows
"male" and "female", the real stored values are maybe 1 and 2, as
example, and if so, test these values, not what is displayed through the
lookup.





Hoping it may help,
Vanderghast, Access MVP
 
A

AshParr

Is there a way to calculate (count female and male clients) at the end of a
report based on whether they put male or female in the record. For example:

Santa Clause Male
Easter Bunny Female
Tooth Fairy Female
Frosty Snowman Male

I know how to do a group by query and count function but was hoping not to
have a query and then subrpt.

Im no expert on access but i think i can help you (ill try my best
anyway)

Is this a standard report?

If so try putting this in your footer:

=Count(IIf([Gender]="M",0))
=Count(IIf([gender]="F",0))

I have done something similar but as a total count, im sure there may
be away of adopting it
try putting a text box in the detail of your report and one in the
footer.

The one in the detail set its control source as "=1" and call it
"Count" and set the running sum to Over All
Then set the control source for the one in the footer as the name of
the text box in the detail ="Count"
 
G

Guest

Why not use a totals query as the record source of a subreport? This would
allow you to easily add Witches, Gremlins, Snow White,... without changing
control sources or adding new controls. Reports should be self maintaining.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top