How can I count the number of records returned in a query?

skydart

New member
Local time
Today, 05:08
Joined
Jan 12, 2005
Messages
5
I want to write a query and count how many records that query returns to me. I'm using Access 2003. Can someone please show me how to do this? :eek:
 
use the count(*) function

example:
SELECT Count(*) as NumRecords From..........
 
Sky:

Assuming your query is called qryQuery1:

SELECT Count (*) AS [Number of Records]
FROM qryQuery1;

Should do the trick.

SHADOW
 
Thank you!

Thank you very much, guys. I'm endevoring to learn Access, but my Dad knows Access pretty well and got hung up on this question. I'll pass your comments on to him to see if this answers the specific question he had.

Should I have any other questions relating to this thread, I'll be sure to post them here. I so appreciate the fast response! 4 minutes!
 
By building a new query such as:-
SELECT Count (*) AS [Number of Records]
FROM Query1

you need to run the new query before you can get the number.


There is a corresponding DCount() function that you can use directly. For example, to put the number of records in a text box on a form, you can simply set the Control Source of the text box to:-

=DCount("*", "Query1")

.
 

Users who are viewing this thread

Back
Top Bottom