473,805 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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]","qrySport s","[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]","qrySport s","[Sport] = 'Basketball'")/Count(*) And
Queries!qrySpor ts![Enter Beginning Date] & " to " &
Queries!qrySpor ts[Enter Ending Date]
OR is there a better way to accomplish this?

Thanks everybody!

Megan
Nov 13 '05 #1
1 2837
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]","qrySport s","[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]","qrySport s","[Sport] = 'Basketball'")/Count(*) And
Queries!qrySpor ts![Enter Beginning Date] & " to " &
Queries!qrySpor ts[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]","qrySport s","[Sport] = 'Basketball'")/[FooterCountFiel d]
Nov 13 '05 #2

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

Similar topics

7
5598
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 button on another form (frmEmpList) which has a list box that contains the names of all employees. When a name is selected in the list box and the button is clicked, frmVacationWeeks opens and is filtered using the following: ". IN (" & Left(strSQL,...
4
7539
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 requirements to work and have tried a number of different formats. At the moment I am getting an object required error message. This is the current code: Function UpdateDistributionCost(Suff As String) ' adds new record if none exists, prompting...
6
3319
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 parameter query which is the recordsource for the report. The parameter is <=. The query returns the correct amounts upto the date entered (no need for "between" dates here). There are 8 textboxes with dcounts; 2 other boxes Sum some of these
2
1958
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
3332
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 query I am trying the following: NumOfYes: Dcount(,"qryIndividualFeedbackDetail",=4) The query is counting ALL of the timely manners and is ignoreing my
13
6591
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 its not a saved querydef - just an SQL string that I cooked up in code and assigned to a global var strMySQL.
2
7946
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 perform are either Clean, Shampoo or Vacuum. I have a query called Details that shows a history of all the jobs they have performed. On my report I want a total for each employee of how many of each job they have performed. This is what I know of...
7
32028
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 and the expression field should be: DCount("LoanDate","tblLoans","Id=CustomerID"), but the query says it can't find the expression parameter. note: the query does work if the experssion uses an ID number for the criteria, for example:...
3
2066
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 show how many instances of something happens. Within the query I am using a calculated filed called "registered".The syntax is Registered: DateDiff("w",,)
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.