fredg said:
On 15 Jun 2006 07:04:11 -0700, Jadabug wrote:
I have a report, "Compounding", containing a text box, "TotalProc", in
the report footer to count all records, it has this control source:
=IIf([HasData],Count([ProcNumber]),0).
I need this calculated number to appear in a text box on a form.
Currently, I have a text box on a form with the following control
source: =[Reports]![Compounding]![TotalProc], but it displays "#Name?".
Any help will be greatly appreciated!
It works for me!
The report MUST be open at the time.
Thanks for trying it - I'm glad it works for you, maybe I'm close! I
did not have the report open, but now that I do, I get the error
"#Error". It may be beneficial to know at the present time, the count
is zero. Also, is there an easier way to achieve this? Maybe in the
query? I just need a total of all records in one query, and I need
this total to be displayed on the report and in the form (which are all
relative to the query). Thanks in advance!
=Count(*) in the Report footer will display the count of all the
records in the report.
If you are trying to display a value of 0 in the form if the report
contains no records, in that unbound control on your form, try:
=IIf(IsError([Reports]![Compounding]![TotalProc]),0,[Reports]![Compounding]![TotalProc])
You could also use (in that form control):
=DCount("*","QueryName")
The difference is the DCount counts the records in the query, while
the other counts the records in the report (which may have been
filtered in addition to that filtering done in the query). It's your
choice.