Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Count function

Status
Not open for further replies.

ton9

Programmer
Apr 17, 2001
5
US
I have a field that has a Yes/No value. I need to get a count of all the yes values for a report. How do I do this?

Thanks
 
SELECT count(PrimaryKeyFieldName) as NumRecs FROM TableName WHERE NameOfYesNoField = 'Yes'

will return the count. You could use DCount to do the same thing. Or just do this in code in the page event of your form. Or several other things.

But that should get you started.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Thanks for the answer, but I am trying to do this in a report in Access. So when I am in Design view I right clicked on the text box to get to the properties so I then am working in the expression builder but do not know how to write it to get Access to count the field with a yes/no value.
 
Hi,

I'm a bit of a newbie, but could you create a query which would count the number of "Yes/True" records? In your query design grid, turn on the Total feature, select Count, and set the criteria to True. I don't know how this fits with what your report is based on but it could be a start.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top