I am attempting to write a query that will search a table for a specific gender and then total the amount of people it finds, then rerun for the other gender and return both results so I can use them in a report. Is this possible?
You can use the DCount() function in VBA code or as an expression in a text box's Control Source property.
=DCount("*", "[red]tablename[/red]", "Gender='M'"
You can also use a GROUP BY query (a.k.a. Totals query) to get both values at once.
SELECT Gender, Count(*) FROM [red]tablename[/red]
GROUP BY Gender
Rick Sprague
Want the best answers? See faq181-2886 To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.