More summing problems

G

Guest

I tried to post this earlier and received an error. Sorry if it's double
posted.

I have a report in the form main report with 2 subreports. The subreports
are for customer and prospect calls. Often times there are no prospect calls
made on a particular day. In the footers of each subreport I have a control
that counts the number of records in each of the subreports. There are 2
controls on the main report to show the values of the counts adn reference
the fields in the subreport footers. So long as there are records in both
subreports the fields on the main report are filled in properly. When the
prospect subreport has no records I recieve #error in the field on the main
report. In the main report field I have tried;

IIf(subreport!CountField=0,0,SubReport!CountField) or
IIf(IsNull(SubReport!CountField),0,SubReport!CountField) and
nz(SubReport!CountField,0) and variations on a theme. Most work as long as
data exists in the subreport.

I have tried to use the On No Data event of the subreport to at least send a
message box to no avail. Additionally, I created a form with a button to
msgbox the value in the footer field and recieve an run-time error'2427': You
entered an expression that has no value.

Any help will be greatly appreciated.

Barry
 
M

Marshall Barton

Barry said:
I have a report in the form main report with 2 subreports. The subreports
are for customer and prospect calls. Often times there are no prospect calls
made on a particular day. In the footers of each subreport I have a control
that counts the number of records in each of the subreports. There are 2
controls on the main report to show the values of the counts adn reference
the fields in the subreport footers. So long as there are records in both
subreports the fields on the main report are filled in properly. When the
prospect subreport has no records I recieve #error in the field on the main
report. In the main report field I have tried;

IIf(subreport!CountField=0,0,SubReport!CountField) or
IIf(IsNull(SubReport!CountField),0,SubReport!CountField) and
nz(SubReport!CountField,0) and variations on a theme. Most work as long as
data exists in the subreport.


Check the subreport's HasData property.

=IIf(subreport.Report.HasData,subreport.Report!CountField,0)
 
G

Guest

Dear Marshall:

Most excellent. That seems to work very nicely. I am however a little
confused as to why the nodata event is not triggered. Oh well, life is full
of little mysteries. Thanks very much for your help, it is most greatly
appreciated.

Barry
 

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