A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Counting multiple field values in a single query/report



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2010, 11:08 PM posted to microsoft.public.access.queries
KatK
external usenet poster
 
Posts: 2
Default Counting multiple field values in a single query/report

I am creating a database for a community program that includes a number of
fields with drop down choices, such a race, school, abuse history, family
composition. We want to total/count each of these variables for a
particular date range. I can create separate summary queries to get totals
for each, such a total number of african americans, total white, total asian,
total other, but then the date range has to be re-entered over and over.
Have tried creating one master query/report for just the date range, then
pulling in the others as subreports, but it ends up showing each record
individually instead of the summary. I am a bit of a novice with queries
beyond the basic. Is there a way to do one query and/or report with it all??
  #2  
Old February 14th, 2010, 11:17 PM posted to microsoft.public.access.queries
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Counting multiple field values in a single query/report

use an unbound form. Create two text fields to hold the start and end dates,
and then pass them in the code that opens the report...

strDateFilter = "[DateField] BETWEEN #" & Me.txtStartDate & " # AND #" & Me.
txtEndDate & "#"
DoCmd.OpenReport "MyReport",,,strDateFilter

(Can't remember which argument is the filter, so check it in VBA...

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

  #3  
Old February 15th, 2010, 03:59 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Counting multiple field values in a single query/report

Use an unbound form. Create two text fields to hold the start and end dates,
and then pass them in the criteria like this --
SELECT [School], [Race], Count([Race]) AS CountOfRace
FROM YourTable
WHERE DateField Between CVDate([Forms]![YourFormName]![StartDate]) AND
CVDate([Forms]![YourFormName]![EndDate])
GROUP BY [School], [Race];

Open the form and enter dates in form and leave open when you run the form.

--
Build a little, test a little.


"KatK" wrote:

I am creating a database for a community program that includes a number of
fields with drop down choices, such a race, school, abuse history, family
composition. We want to total/count each of these variables for a
particular date range. I can create separate summary queries to get totals
for each, such a total number of african americans, total white, total asian,
total other, but then the date range has to be re-entered over and over.
Have tried creating one master query/report for just the date range, then
pulling in the others as subreports, but it ends up showing each record
individually instead of the summary. I am a bit of a novice with queries
beyond the basic. Is there a way to do one query and/or report with it all??

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.