errorl values in reports

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
 
G

Guest

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
 
D

Duane Hookom

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])
 
T

Tony Williams

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
 
D

Duane Hookom

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

Tony Williams

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
 
T

Tony Williams

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
 

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