Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Count Query Results to a Form 1

Status
Not open for further replies.

gallas

Technical User
Feb 5, 2002
55
GB
It seemed very easy. But! I have a form with a record source that is a count query. The sql looks like this:

SELECT DISTINCTROW People.SpecialMailout, Count(*) AS [Count Of People]
FROM People
GROUP BY People.SpecialMailout
HAVING (((People.SpecialMailout)=-1));

On the form is one textbox control. The control source is Count Of People. The textbox shows the count as information for the users. There are also a couple of command buttons to fire various actions.

The form works fine as long as the query returns a value. But if no records are found / counted that meet the criteria then the form loads completely blank. I tried making the form unbound ie. no record source and creating a textbox that had the query as its Control Source but I'm struggling with #Name? errors.

Anyone any ideas?? :-D


"If a job's worth doing, it's worth doing twice!"
 
You may try this as ControlSource:
=DCount("*", "People", "SpecialMailout=-1")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, Very simple solution. Works fine.:-D

"If a job's worth doing, it's worth doing twice!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top