Counting same rows in a table

J

Julia82

Hi,

How can I count same rows in a table? ex.

ID NAME
1 MARY
2 JOHN
3 MARY
4 MARY
5 JOHN

I want to know how many JOHN there are?

Thanks!
 
P

pietlinden

Hi,

How can I count same rows in a table? ex.

ID     NAME
1       MARY
2       JOHN
3       MARY
4       MARY
5       JOHN

I want to know how many JOHN there are?

Thanks!

use a totals query

SELECT Name, Count(*)
FROM tblNames
ORDER BY Name
GROUP BY Name
 
J

Julia82

I have a textbox that changes. Inside are names.

I want where the name in my query matches the name in that textbox, another
texbox displays me the count of duplicates for that user.

I don't know how to get the values from the query and put them on my form

Thanks!
 
S

Stuart McCall

Julia82 said:
I have a textbox that changes. Inside are names.

I want where the name in my query matches the name in that textbox,
another
texbox displays me the count of duplicates for that user.

I don't know how to get the values from the query and put them on my form

Thanks!

First off, if you're actually using "Name" as a field name then don't. It's
a reserved word in Access and will give you trouble sooner or later. Make it
'UserName' for example.

I would use the Dcount function to obtain the number of dupes:

OtherTextbox = Dcount("UserName", "tblNames", "UserName = '" & MyTextbox &
"'")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top