473,396 Members | 1,834 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,396 software developers and data experts.

How do I get a COUNT result to show up by itself on a report?

(Using Access 2007)
For a report I need to create and submit, they want counts of how many employees fit into a few given categories, and then they want some simple totals involving those count numbers.

I know how to create a query that returns the count number for a given category. I use the count function to count how many records are returned by the queries I've created to define the categories. That's easy.

However, when I try to enter a count query in the control source property of an unbound text box, it doesn't work, and I can't yet figure out some way of doing this.

I don't want to show the actual records returned by my category queries--I only want to show the count number, and I want to show counts for several queries.

Don't really care how I do it, I just want the count number in a box on the report.

Make sense? Please let me know if you need more information.
Jan 28 '10 #1
9 4038
Echidna
53
Hi,

For the report, are you wanting a summary style ie
Category A 50
Category B 112
etc

or something more comprehensive like

Category A 50
Category A member 1
Category A Member 2
etc

Cheers

Leon
Jan 28 '10 #2
Summary style. Specifically what I need is:

Category A 5
Category B 3
Total A+B 8
Category C 2
Total above -C 6
Category D 1
Total above -D 5

Make sense?
Jan 28 '10 #3
Echidna
53
Hi

Hope this helps.

Expand|Select|Wrap|Line Numbers
  1. =DCOUNT("Employees","Employees","[EmpCategory]= 'CatA'")
  2. =DCOUNT("Employees","Employees","[EmpCategory]= 'CatB'")
  3. =DCOUNT("Employees","Employees","[EmpCategory]= 'CatA'") +
  4. DCOUNT("Employees","Employees","[EmpCategory]= 'CatB'")
  5.  
but that would be more for a form than a report though

You could separate the Category within the report as a group, and have a query for the source of the subreport, then having a second subreport for the second group of categories.

Something like

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Category, COUNT(Category) AS CatCount
  2. FROM Employees
  3. GROUP BY Category
  4. HAVING (Category = 'CatA') OR (Category = 'CatB')
  5.  
Cheers

Leon
Jan 28 '10 #4
I figured it out! Or at least I found a solution. Hopefully there are better solutions, but I ended up creating a subreport for each of the numbers I needed, adding an unbound text box with a COUNT function in it at the bottom of each subreport, and then making all parts of the subreport (other than the COUNT text box content) invisible. Then I made each subreport really small and positioned it so the COUNT result would show up where I wanted it. This makes the Design view and Report Views a little crazy, but it prints out looking how I want it, with the data I want. Thanks for your help. And sorry I wasn't clear about my categories. When I said "category A", I didn't mean "Count every record from the Employees table that has a value of A in the category field." I actually meant something like: "Count how many records are returned by the query that queries which employees are x and have not done this since this date." But still, Thank you! And if you see an easier/simpler way, I'm still open for suggestions.
Thanks,
Dean
Jan 29 '10 #5
TheSmileyCoder
2,322 Expert Mod 2GB
1.
Use the DCount function, simply write in the textbox, as its Controlsource:
Expand|Select|Wrap|Line Numbers
  1. =DCount("*","Tbl_Name","WHERE CLAUSE Without the Where word")
2.
Create a combox in your report (Don't worry the report doesn't show the dropdown button, looks just like a textbox)
As the recordsource, write your Count query, where the Count result should be placed in the first column.
Jan 29 '10 #6
NeoPa
32,556 Expert Mod 16PB
Reports actually have the facility to handle aggregation within them at a report level (rather than relying on the underlying query to handle this).

If a TextBox in the detail section (which may be hidden if necessary) is called txtDtl, then TextBoxes in any of the header sections (Section Headers, Page Header or Report Header) can have the formula =Count([txtDtl]), and the value shown will reflect the count for the relevant data. Potentially different in each section.
Jan 30 '10 #7
Can you give a little more detail on this response #7. You referred to it on my other thread, but I'm not sure how to apply it. My report as a whole is unbound, because it pulls data from so many sources, and I've never been able to get =COUNT([field]) to return anything unless the data I wanted to count was also present on the same report. If I had a text box called txtDtl, what would it be bound to in order to get COUNT to return what I want?
Feb 2 '10 #8
NeoPa
32,556 Expert Mod 16PB
The other thread mentioned is How do I get a COUNT to return a 0 on a report? btw, if anyone's interested in following the flow.
Feb 2 '10 #9
NeoPa
32,556 Expert Mod 16PB
It would be bound to the item you wanted counted.

Let's be clear :
If the count you want is of native data, data available and already processed within the record source of the report (the bound table or query), and this data has a control bound to it, you can use the suggestion from post #7 referring to the other control internally (within the report object).

If not, it is foreign data, possibly in a table unrelated to anything you're already processing within your report, then Domain Aggregate functions (DCount() etc) are more appropriate, as the other has no way of working.

Which control you use in your report depends on your choices. I'm afraid I can't help you much there (I don't know what any are after all).
Feb 2 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Yasin | last post by:
Hi I have one reports which shows the Account wise daily transaction during the day.(pl's find below report layout format with column description) May or may not be each account have multiple...
2
by: L Mehl | last post by:
Different users of the app will want or not want to see report footer ( appears as a separate page). I can make the section invisible with a DLookup of a Y or N value from a 'parameters' table ...
2
by: Stephen | last post by:
Hello all Run into a problem with a count query in access. It seems to count either all the results or none depending on criteria even though I have a query that selects the difference in...
2
by: wilscott1st | last post by:
Is it possible in access to select the total count of records for a given group of records and show those all those counts in one report? For example, I have a table of records that contain...
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
3
by: Miguel | last post by:
I have a parameter query to filter by date from which I run a report. I need to be able to count the number of times a particular product or error type appears after the report is run from the...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
1
by: iht | last post by:
Fairly new to Access and really doesn't know much about SQL except some basic commands. Currently I'm working with a database that I've already sorted by some queries, and here's a simplified...
14
by: zufie | last post by:
I have to create a QA report regarding callers calling into a phone hotline. The report consists of many checkboxes such as: Did the IBCCP agency contact you? Yes/NO How many days passed...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.