Using DCount with group footer

Indigobuni

Registered User.
Local time
Yesterday, 19:37
Joined
Oct 9, 2001
Messages
26
I have a report based on a PC Inventory table. The table contains 3 locations (ex. Chicago, Houston, Atlanta). Within each location, the employees are listed with their desktop info, Monitor info, laptop info. My report is grouped by location. What I am trying to do is count how many desktops, monitors, etc are in each location and list that at the end of each grouping. I got the DCount expression to work ("[Product Description]", "PC Inventory Master", "[Product Description]='Desktop'"). I did this for the monitors and laptops as well, but it's only giving me a Grand Total for all three places combined. I want it to give me a total for each location within the report. So, when I see the report, at the end of the Chicago grouping, I will see how many desktops, how many monitors, etc... and the same for Houston and Atlanta. How do you incorporate the DCount expression when you have your data grouped? Thanks.
 
Last edited:
If you look at the DCount() syntax, you'll see that you can specify a where clause to qualify the rows selected for the count.
 
Ok, color me stupid. Could you show me an example? Here is my expression =DCount("[Product desc]","PC Inventory-Master","[Product desc]='Atlanta'"). PC Inventory is the database. Product desc (either Monitor, Laptop, Desktop). Location is either Atlanta, Chicago, Houston. I am not familiar with WHERE clauses to know where in the syntax to put it and how to word it if I want to count the monitors in Atlanta? Now, the report is based directly off the table, it is not based off a query at all, does that matter?
 
=DCount("[Product desc]","PC Inventory-Master","[Product desc]='" & Me.YourCityNameField & "'").

Replace Me.YourCityNameField with the name of the city field in your recordsource.
 

Users who are viewing this thread

Back
Top Bottom