473,799 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counting distinct Surnames on report

I have a report which has records of students in various courses. It would
normally show say 400 entries for 80 students doing an average of 5 courses
each. I want to say on the report how many different students there are.
Normally, I'd just use "No. Students = " & Count([Surname]) , but this just
gives me 400 - how do I do a count of Distinct Surnames on a report?

dixie
Nov 13 '05 #1
4 3299
Create a query that returns the distinct surnames. Then use DCount on that
query.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"dixie" <di****@dogmail .com> wrote in message
news:VK******** ******@nnrp1.oz email.com.au...
I have a report which has records of students in various courses. It would normally show say 400 entries for 80 students doing an average of 5 courses each. I want to say on the report how many different students there are.
Normally, I'd just use "No. Students = " & Count([Surname]) , but this just gives me 400 - how do I do a count of Distinct Surnames on a report?

dixie

Nov 13 '05 #2
Hi Dixie,

In Help, look up TOP. You can create your query using the QBE format but
you must go to SQL view to add "TOP 1".

Note that I'd change the query to return Last, First, Middle in order to
catch repeating surnames. Otherwise you'd count all of the Smiths as one
person. :-)

HTH
--
-Larry-
--

"dixie" <di****@dogmail .com> wrote in message
news:VK******** ******@nnrp1.oz email.com.au...
I have a report which has records of students in various courses. It would normally show say 400 entries for 80 students doing an average of 5 courses each. I want to say on the report how many different students there are.
Normally, I'd just use "No. Students = " & Count([Surname]) , but this just gives me 400 - how do I do a count of Distinct Surnames on a report?

dixie

Nov 13 '05 #3
Not sure how having TOP 1 is going to give the number of distinct Names.

And you don't actually have to go to the SQL view to set the TOP 1. Open the
query's Properties. One of the properties is Top (3rd one one down in Access
97, 4th one in Access 2003: don't have any other versions of Access
installed on this machine)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Larry Daugherty" <La************ ********@verizo n.net> wrote in message
news:vv******** *******@nwrddc0 3.gnilink.net.. .
Hi Dixie,

In Help, look up TOP. You can create your query using the QBE format but
you must go to SQL view to add "TOP 1".

Note that I'd change the query to return Last, First, Middle in order to
catch repeating surnames. Otherwise you'd count all of the Smiths as one
person. :-)

HTH
--
-Larry-
--

"dixie" <di****@dogmail .com> wrote in message
news:VK******** ******@nnrp1.oz email.com.au...
I have a report which has records of students in various courses. It

would
normally show say 400 entries for 80 students doing an average of 5

courses
each. I want to say on the report how many different students there are. Normally, I'd just use "No. Students = " & Count([Surname]) , but this

just
gives me 400 - how do I do a count of Distinct Surnames on a report?

dixie


Nov 13 '05 #4
If I understand what you're trying to achieve this might do it?

SELECT surname, Count([studentID]) AS numberOfStudent s
FROM tableName
GROUP BY surname

HTH

Simon.

"dixie" <di****@dogmail .com> wrote in message
news:VK******** ******@nnrp1.oz email.com.au...
I have a report which has records of students in various courses. It would normally show say 400 entries for 80 students doing an average of 5 courses each. I want to say on the report how many different students there are.
Normally, I'd just use "No. Students = " & Count([Surname]) , but this just gives me 400 - how do I do a count of Distinct Surnames on a report?

dixie



Nov 13 '05 #5

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

Similar topics

9
6151
by: Dave M | last post by:
All I've got a database that keeps track of sales of widgets. Each company that belongs to my organiztion is to report their widget sales or no sales every month. There are several different types of widgets. Not all companies sell or report all types of widgets. We want to report how many companies have reported or not reported their
5
2695
by: Cam Bevis | last post by:
I'm having trouble getting my head around this, and no one in the groups has posted exactly the problem. The table below tracks site traffic across a network. There is 1 row per pageview and UUID is that user's unique cookie. CREATE TABLE . ( NOT NULL , NULL , NULL ,
3
1969
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let me give you a little background. this database is kind of like a human resources database. it collects info about people, where they work, and if they have any work-related issues where they work.
1
2828
by: mjobrien | last post by:
Thanks for the hint Allen (see below). But I am already doing that count as total records read (5)in the report footer. That count is unduplicated for the record not for the field - student ID as I've indicated in my sample report. I really need an unduplicated count of the student ID only. I guess my subject was not clear. ------------------------------------------------------------------------------ From: Allen Browne...
18
2946
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other employee knows anything about Access. I've searched Google Groups, and that has been a lot of help, but there are some questions that I just can't find the answer to. I'll try to take it easy on the group after this question. I have one more...
4
1894
by: BJ | last post by:
Can anyone tell me how to include a count of group records in a group footer. I know (I think I know!) that I have to include an unbound text box in the footer, but what expressions do I use to count the entries within a group (subtotals I suppose). eg: the column (group) headings are something like this: Area Surname London Smith Giles
1
1519
by: ye2127 | last post by:
Hi, I have two fields in my report. One of them is school name(the school name appears multiple times). The other field is class test score. How would I go about calculating the test average for each school?(In a report) I can calculate the average of all the schools but am having difficulty coding some kind of sort procedure for an average test score of all the classes in each school. Does someone know the code for such a procedure?...
1
3738
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for statistical purposes. I've been using Here’s the situation: I have two main tables: Guest (stores data such as GuestID, First Name, Last Name, etc.) and Services (stores data such as the type of service the guest used (Shelter Bed, Lunch, Dinner,...
3
3455
by: raghunath1981 | last post by:
Hi All, Could you please help me with writing a sql for counting number of times a varchar (1000) repeated in the table. I think I cannot use groupby/distinct etc. Please give me an idea how I could do that if I want the output such that each row is the varchar (distinct) and number times it repeated. I was trying several things but it did not work :( select tab1.varchar_col , tab2.CNT from tab tab1 ( select count(*) from tab group...
0
9688
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
9546
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
10490
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
10260
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...
0
9078
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
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
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
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.