473,378 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

DCOUNT and DateRange Parameter

Hi Everybody-

I've been reading some of the posts about DCOUNT, and I haven't yet
found an answer; so, I'm posting this question.

I have a report that I'm trying to use DCOUNT on to compute the
percentages of each group. The groups are based on sports. For
instance, football, soccer, baseball, basketball. I have a table of
people that play these sports.

My report groups the sports people play. For example, my report may
look like this:
GROUP Header 1

Basketball:
Michael Jordan
Kobe Bryant

GROUP Footer 1
Total: 2 (Using the simple Count(*) in the Group
Footer)

GROUP Header 2

Soccer:
David Beckham

GROUP Footer 2
Total: 1

REPORT Footer

Grand Total: 3 (I'm using Count(*) again here)

Then in the Footer of my report, I use the Count(*) function again to
compute the total number of records. Then, I use the DCOUNT function
to compute the percentages of people that play each sport.

=DCount("[Sport]","qrySports","[Sport] = 'Basketball'")/Count(*)

So, for "basketball," I would get: 2/3 = .667

HOWEVER...when I try to use a Date Parameter as a criteria in my
query, I get an error (#ERROR).

In the criteria for my "Date" field, I'm using: Between [Beginning
Date] And [Ending Date].

I've read a few posts where some people have tried a few different
things, such as creating multiple queries or creating a form to use.

So, I guess my question is: Will DCOUNT work if I add extra code to
it?

For example:

=DCount("[Sport]","qrySports","[Sport] = 'Basketball'")/Count(*) And
Queries!qrySports![Enter Beginning Date] & " to " &
Queries!qrySports[Enter Ending Date]
OR is there a better way to accomplish this?

Thanks everybody!

Megan
Nov 13 '05 #1
1 2803
Megan wrote:
Hi Everybody-

I've been reading some of the posts about DCOUNT, and I haven't yet
found an answer; so, I'm posting this question.

I have a report that I'm trying to use DCOUNT on to compute the
percentages of each group. The groups are based on sports. For
instance, football, soccer, baseball, basketball. I have a table of
people that play these sports.

My report groups the sports people play. For example, my report may
look like this:
GROUP Header 1

Basketball:
Michael Jordan
Kobe Bryant

GROUP Footer 1
Total: 2 (Using the simple Count(*) in the Group
Footer)

GROUP Header 2

Soccer:
David Beckham

GROUP Footer 2
Total: 1

REPORT Footer

Grand Total: 3 (I'm using Count(*) again here)

Then in the Footer of my report, I use the Count(*) function again to
compute the total number of records. Then, I use the DCOUNT function
to compute the percentages of people that play each sport.

=DCount("[Sport]","qrySports","[Sport] = 'Basketball'")/Count(*)

So, for "basketball," I would get: 2/3 = .667

HOWEVER...when I try to use a Date Parameter as a criteria in my
query, I get an error (#ERROR).

In the criteria for my "Date" field, I'm using: Between [Beginning
Date] And [Ending Date].

I've read a few posts where some people have tried a few different
things, such as creating multiple queries or creating a form to use.

So, I guess my question is: Will DCOUNT work if I add extra code to
it?

For example:

=DCount("[Sport]","qrySports","[Sport] = 'Basketball'")/Count(*) And
Queries!qrySports![Enter Beginning Date] & " to " &
Queries!qrySports[Enter Ending Date]
OR is there a better way to accomplish this?

Thanks everybody!

Megan


I don't know if this will work.

Instead of /Count(*), use the name of the text field that contains the
count.

=DCount("[Sport]","qrySports","[Sport] = 'Basketball'")/[FooterCountField]
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: jdph40 | last post by:
I posted this problem previously and received excellent help from Wayne Morgan. However, I still have an unanswered question. My form (frmVacationWeeks) is opened from the OnClick event of a...
4
by: Will | last post by:
Hi, I had a DCount within a module on records in a table where CustSuffix = 0. I now need to DCount where CustSuffix = 0 and the type of cost Suffix (Suffix in table) = G. I can't get both...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
2
by: Paul T. RONG | last post by:
Hi, I have a problem with DCount, the following code doesn't work: DCount("", "qryOrder", "( = Me! AND = 'drink')" > 0 Please help. Thank you.
3
by: BerkshireGuy | last post by:
I am having difficulty with using the Dcount function. I am trying to return the number of records from qryIndividualFeedbackDetail where the TimelyManner field is set to 4. So, in the new...
13
by: MLH | last post by:
Suppose I have this simple SQL string... SELECT tblDrivers.DriverID, tblDrivers.DName FROM tblDrivers WHERE (((tblDrivers.DName) Like "N*")) ORDER BY tblDrivers.DriverID; And suppose that...
2
by: Wingz | last post by:
Hiya, Fairly new to Access and was wondering what the best way to perform Dcounts on groups in an Access report. For example, I have 10 employees and the different instances of jobs they can...
7
by: Michael R | last post by:
Good afternoon. I'm stucked in composing the syntax for DCount expression in a select query. The query qryCustomers has CustomerID field, the DCount function uses tblLoans with LoanDate and Id fields...
3
by: davidwelli | last post by:
Hello, All help is appreciated, I'm struggling with the following. Using Access 2003 (front end) connecting to Oracle 7 database (back end). I'm trying to create a query in access that will...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.