Record Count from Number of results in a query?

Moonshine

Registered User.
Local time
Today, 15:21
Joined
Jan 29, 2003
Messages
125
Lemme try to explain what im trying to do...

Button number 1 runs a query, that gets X number of records, be it 3200 or 124 or whatever, the number changes depending on the date the query is run. The records are the standard recordset you get when you run a access query

What i want is a second button, that will get the total number of records in that query, say for example 1562 (No other details, just need the number) divide that number by another number in a text field on the same form, and then times by 1000.

Is this possible? I dont know how to get the "recordcount" of a query.....
 
You are looking at doing a DCount on the query. It can be a text box's data source. That will give you the number of records returned.
 
Hrmmm, that sounds like what im after but i dont know how to go about doing it :)

I just put a temporary text box on the form, and went into the "ControlSource" of teh text box... how in there do i make it count the query?
 
Well generally if you right click on the control source and go to build it will open the expression builder and you would do it from there.

There is help available for all of the built in functions.

A DCount is structured:

DCount("[Field Name]","query/table name","Condition")

You many not need the condition depending on how your query is structured.
 
Im never much sue with the help!! bascially the control source of the text box is now this:

=DCount(" [qry DC - LD And Residential Inc Agency and Cost]![PER_ID] "," [qry DC - LD And Residential Inc Agency and Cost]")

the first part in the "" is the PEr ID field, this is just a 7 digit number.

The second part is the actual query name.

Yet when i open the form i i get #Error in the text box... so im guessing i am doing some really wrong :/

The query has 3 fields that you see, the first one is Paris_ID which is a 7 digit number, second one is First Name which is the the persons first name, and the 3rd is the surname.....

I hope this helps :/
 
Remove the spaces on either side of your expression components

i.e

=DCount("[PER_ID]","[qry DC - LD And Residential Inc Agency and Cost]")
 
Yes!!!!

Thanks to you both, its worked perfectly :)
 

Users who are viewing this thread

Back
Top Bottom