Text Box on Form, Control Source from Report

J

Jadabug

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!
 
F

fredg

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.
 
J

Jadabug

fredg said:
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!
 
F

fredg

fredg said:
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.
 
J

Jadabug

fredg said:
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.

Thank you, thank you, thank you. The DCount worked, and now I don't
have to have the report open. I know it was probably a simple fix for
you, but you made my day!
 

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