Count records in query?

johandenver

Registered User.
Local time
Tomorrow, 00:03
Joined
May 4, 2010
Messages
27
Hi!

I'm trying something I thought was easy but I can't get it right.

I want to count the number of records in a query and display the result in a textbox. I've tried Count and DCount but it just won't work :-(

Can someone tell me the exakt syntax for these functions?

My query is called Filter by type
and the only column in the query is called Full Unitname
 
You may need to make a new query that uses it's query as it's data source and then use the totals button to group and select count as the option.
This will give you the count of the records in your first query.
This sql will give you a count of the records in QryName.

SELECT Count(QryName.FieldName) AS CountOfFieldName
FROM QryName;

Can you then use DLookup to have the result showing in a textbox on your form?
 
It worked when I made a new query to count the old one.

Thanks.
 
or just

recordcount = dcount("*","queryname")


in fact you can set a text box control value TO BE

= dcount("*","queryname")

then all you need to do is

mytextbox.requery, if it changes
 

Users who are viewing this thread

Back
Top Bottom