In Continuation of my recent post : Civil Registry App in Microsoft Access – Finally!
Encountered an issue in access where I need to get the values of Gender and Age.
Now What I need to do is to count the total number of male or female residents based on the age using the query, and I need to display those calculated values in a textbox. After sorting and scouring info in the web.
I decided to use DCOUNT().
I translated the problem with an SQL statement.
using Dcount(name of field, queryname, criteria)
I tried =DCount(“AGE”,”totalpop”,” AGE = 24 AND gender=’female’”)
because of the dcount format I was following, errors kept showing if I added both criterias gender and age but it works fine with just one criteria
until I came up with this by accident.
=DCount(“gender” And “AGE”,”totalpop”,” AGE = 24 AND gender=’female’”)
… sometimes the solution is in front of our noses, it’s how you look at it.
Basically reviewed these articles for the solution.
- Queries V: Use And, Or, and In to set multiple conditions
- Create a query based on multiple tables
- How do you use DCOUNT for multiple criteria?
- Dcount with multiple criteria Access 2007
I’ll be back with more misadventures and my quick fixes.
Interesting Reads, Check it out!
- Civil Registry App in Microsoft Access – Finally! (jaren.cudilla.net)
- Trying to get a text box in access to display the latest row in a query on button press (stackoverflow.com)
- few SQL queries problem (daniweb.com)
- Microsoft Office Access can’t find the database file ‘C:\euaPRoDv2\ILCPCR.mdb (community.spiceworks.com)