View Full Version : DCount with two criteria


MRDIRK
03-08-2007, 09:24 PM
I'm trying to use DCOUNT to count the number of members in my database who live in Baltimore and whose hobby is Golf and display this number on a report. There are 125 records in my database. Of these, 90 live in Baltimore and 75 list Golf as their hobby. When I try the first line of code below, it simply returns the total number of records in my database (125). When I try the second line of code, it correctly returns the number of those that live in Baltimore (75).

=DCount("[CITY]", "tblMembers", "[CITY] = 'Baltimore'" AND "[HOBBY] = 'Golf'")

=DCount("[CITY]", "tblMembers", "[CITY] = 'Baltimore'")

I've tried following some examples found here but they are much more complex than what I'm trying to accomplish. I know I can probably create queries, but I'd rather learn to do it this way.

Thank you all.

Kindly,
Mr Dirk

pbaldy
03-08-2007, 10:11 PM
Too many double quotes:

=DCount("[CITY]", "tblMembers", "[CITY] = 'Baltimore' AND [HOBBY] = 'Golf'")

MRDIRK
03-09-2007, 10:26 AM
Thanks pbaldy!