Access 2010. I have a drop down list with "Male" or "Female" as the choice. I wish to count the number of Males and the number of Females to show on a report. The Field name is [Gender] which is stored in a table.
Is there a code to use in an unbounded text box that will show the totals on a report? I have tried =Count(If[Gender])="Female")) and it returns 'Error' as the value.
Thank you,
Bob
Actually, I may have missed the more obvious problem with your attempt. If the control is called [Gender] (rather than just the field) then your code would need to be something like : - =Count(IIf([Gender]='Female',[Gender],Null)
or even : - =Sum(IIf([Gender]='Female',1,0)
5 3380
As you said, the gender data is store in a table, so you'll need a query to run instead. Something like this: -
select count(*) as total,
-
sum(iif(gender = 'male',1,0)) as male,
-
sum(iif(gender = 'female',1,0)) as female
-
from mytable
-
NeoPa 32,556
Expert Mod 16PB
In your footer you can use the standard aggregate functions (Count(), Sum(), etc), but they can only refer to controls on your report object, not to the fields of the record source.
The items that are aggregated will depend on the level of the footer involved.
Welcome to Bytes!
NeoPa 32,556
Expert Mod 16PB
Actually, I may have missed the more obvious problem with your attempt. If the control is called [Gender] (rather than just the field) then your code would need to be something like : - =Count(IIf([Gender]='Female',[Gender],Null)
or even : - =Sum(IIf([Gender]='Female',1,0)
Yes,that works. Thank you to Neopa and Colintis for your help. I appreciate it.
NeoPa 32,556
Expert Mod 16PB
It's a pleasure Bob. I'm glad it helped :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: M. Clift |
last post by:
Hi All,
This would seem to be easy, but I have had no luck in working out how to do
this.
In wx.python a list of text is displayed as a bitmap and given it's
position.
shape.pos = (145,...
|
by: Priya |
last post by:
I want to disable individual items in a listbox,listview
in C#.NEt
|
by: kranthi |
last post by:
I want to disable individual items in a listbox or listview
|
by: Larry |
last post by:
Although there are font attribute properties for the items in a ListView
component, the complier tells me that they are read-only. Is there any way
to get access and change the font poperties of...
|
by: Brian Mitchell |
last post by:
Is it possible to gray out individual items in the CheckedListBox? I have an
option at the top of the list that simply says 'All', and when the user
clicks that item I want the rest of the items in...
|
by: satish |
last post by:
Hi ,
I am automating internet.
I am using mshtml and shdocvw.ddl for automations
Can anyone tell me how to automate selection of items from list the e.g of html source is as given
<select...
|
by: josecruz |
last post by:
I have created a combo box for my form. This box displays the individual items properly and runs the report on that particular selection. My question is. How do I code so that a selection of display...
|
by: sideejay |
last post by:
I added some items to my value list in a table but I noticed the value list in the form did not get updated. Why is that? I would have figured they would have a relationship. It is a music...
|
by: redeye |
last post by:
Hi All,
I need to do a count of individual items in one column I call status. The status column contains only three values (‘Not Available’, Partially Available’, ‘Fully Available’). My sql...
|
by: r3bol |
last post by:
Hi, sorry to post this, but I've had a really hard time finding how to
do it.
Q.
How can I break up a value in a list to a list of individual items
(preferably without importing any modules)?...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |