qry totalling

G

Guest

Greetings. I have a form that the users want to see the various totals from
various queries. A simple example is qryLT shows all the claims still open
at the 12 month mark. I have the query and it works fine. But, what the
users want to see in the form is not the result of the query but how many
records it produced. Here is the query. It shows 57 records. It is the
number 57 the users want to see.

SELECT detail.[Claim Number], detail.[Date Claim Closed], detail.[Claim Type
Code], detail.[Total O/S]
FROM detail
WHERE (((detail.[Date Claim Closed])>=#1/1/2004#) AND ((detail.[Claim Type
Code])="LT")) OR (((detail.[Date Claim Closed])>=#1/1/2004#) AND
((detail.[Claim Type Code])="LT") AND ((detail.[Total O/S])>0)) OR
(((detail.[Date Claim Closed]) Is Null) AND ((detail.[Claim Type Code])="LT")
AND ((detail.[Total O/S])>0));

How do I go about getting the number (57) into a textbox on a form?
Thanks to anyone who responds.
*** John
 
G

Guest

If anyone looks at this, no need to respond. I finally got it figured out.
Thanks for taking the time.
*** John
 
M

Marshall Barton

JohnE said:
Greetings. I have a form that the users want to see the various totals from
various queries. A simple example is qryLT shows all the claims still open
at the 12 month mark. I have the query and it works fine. But, what the
users want to see in the form is not the result of the query but how many
records it produced. Here is the query. It shows 57 records. It is the
number 57 the users want to see.

SELECT detail.[Claim Number], detail.[Date Claim Closed], detail.[Claim Type
Code], detail.[Total O/S]
FROM detail
WHERE (((detail.[Date Claim Closed])>=#1/1/2004#) AND ((detail.[Claim Type
Code])="LT")) OR (((detail.[Date Claim Closed])>=#1/1/2004#) AND
((detail.[Claim Type Code])="LT") AND ((detail.[Total O/S])>0)) OR
(((detail.[Date Claim Closed]) Is Null) AND ((detail.[Claim Type Code])="LT")
AND ((detail.[Total O/S])>0));

How do I go about getting the number (57) into a textbox on a form?


How depends on what you are doing with the query. In the
worst case where the query is not related to the form, you
can use a text box with an expression like:

=DCount("*", "nameofquery")

But if the query is used as the form's record source, then
you can use a form header or footer text box with the
expression:
=Count(*)
which is far more efficient than DCount
 

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