errorl values in reports

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a statistical report that is made of a main report and 4 subreports.
There are about 40 controls in all and many are calculated controls. The
report is used to compare data between this quarter and the same quarter
last year. However if there is no relevant data in for the previous year
then obviously the calculations don't work and I get #num and DIV/0 errors.
Is there any way of writing a module that I could put in say the OnNoData
property that would show a 0 instead of the errors? I'm not an expert on
modules and functions so some easy 1,2,3 steps would be appreciated
Thanks
Tony
 
I have a statistical report that is made of a main report and 4 subreports.
There are about 40 controls in all and many are calculated controls. The
report is used to compare data between this quarter and the same quarter
last year. However if there is no relevant data in for the previous year
then obviously the calculations don't work and I get #num and DIV/0 errors.
Is there any way of writing a module that I could put in say the OnNoData
property that would show a 0 instead of the errors? I'm not an expert on
modules and functions so some easy 1,2,3 steps would be appreciated
Thanks
Tony
 
I think it might be more appropriate to use the HasData property.
=IIf(subreportctl.Report.HasData, subreportctl.Report.txtTotal,0)
You should also test for 0 using something like:
=IIf([SomeExpression]=0,0,[AnotherExpression]/[SomeExpression])
 
Thanks guys. is there any way to create a function that I can load when the
report is run that would look at each control and return 0 rather than code
each individual control?
Thanks
tony
 
You could possibly write a procedure that would check the report for
records. If no records are found then make all the controls invisible and
print 0 in their place.
 
Mmmm Thanks Duane that sounds a little out of my depth maybe I 'll have to
stick to the individual control method.
I must get into functions and modules I find them difficult to understand
but they seem so useful
Tony
 
Duane the other point is not all the calculated controls would be empty,
some may have data, some may not so it would have to be a case of checking
if there is data and only print 0 if there isn't. Is that getting too
complicated?
Tony
 
Back
Top