Help with displaying a count on a form

K

KAK

I have created 2 queries that count distinct project numbers from a table in
my Access data base.
Query1 Called QryCntProject1
SELECT tblProjects.[Project Nbr]
FROM tblProjects
WHERE (((tblProjects.[Actively Reporting])=Yes))
GROUP BY tblProjects.[Project Nbr];

Query2 Called QryCntProjects2
SELECT Count(qryCntProjects1.[Project Nbr]) AS CntProjects
FROM qryCntProjects1;

Then on my form I place a text field with the control source of
=[qryCntProjects2]![CntProjects]
the value returned is #name
The query runs fine but I cannot get it to display on the form.
What am I doing wrong?
Can someone please help?
 
D

Dale Fye

use: = DLOOKUP("CntProjects", "qryCntProjects2")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
R

RonaldoOneNil

You don't need the 2nd query. In the controlsource of your text box put this

=DCount("[Project Nbr]","QryCntProject1")
 
K

KAK

Thanks Dale this works fine!

Dale Fye said:
use: = DLOOKUP("CntProjects", "qryCntProjects2")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



KAK said:
I have created 2 queries that count distinct project numbers from a table in
my Access data base.
Query1 Called QryCntProject1
SELECT tblProjects.[Project Nbr]
FROM tblProjects
WHERE (((tblProjects.[Actively Reporting])=Yes))
GROUP BY tblProjects.[Project Nbr];

Query2 Called QryCntProjects2
SELECT Count(qryCntProjects1.[Project Nbr]) AS CntProjects
FROM qryCntProjects1;

Then on my form I place a text field with the control source of
=[qryCntProjects2]![CntProjects]
the value returned is #name
The query runs fine but I cannot get it to display on the form.
What am I doing wrong?
Can someone please help?
 

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