how do I access data on subreport to use in calculation on main re

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subreport that show hours authorized and in the main report I have
hours billed. I want to have a calculated field in the main report that
shows the percentage of billed/authorized. I've tried acccessing the
subreport field using report.[reportname].[fieldname] but when I run the
report it doesn't know what that field is and displays a textbox for data
entry. How can I access the field in the subreport to do the calculation I
need?

Thanks for any help in advance.
 
I actually got this to almost work. I had the subreport name aliased in the
report. Now this works as long as the subreport has data, but when it does
not have data I get a message that I tried to access an object with that does
not have a value. How can I test ahead of time if the subreport field has
value?
 
SuzyQ said:
I have a subreport that show hours authorized and in the main report I have
hours billed. I want to have a calculated field in the main report that
shows the percentage of billed/authorized. I've tried acccessing the
subreport field using report.[reportname].[fieldname] but when I run the
report it doesn't know what that field is and displays a textbox for data
entry. How can I access the field in the subreport to do the calculation I
need?


It really isn't there when a subreport has no records. Use
this kind of expression to guard against the situation:

=IIf(subreport.Report.HasData, [hours billed] /
subreport.Report.[horus authorized], 0)
 
worked perfectly... thanks

Marshall Barton said:
SuzyQ said:
I have a subreport that show hours authorized and in the main report I have
hours billed. I want to have a calculated field in the main report that
shows the percentage of billed/authorized. I've tried acccessing the
subreport field using report.[reportname].[fieldname] but when I run the
report it doesn't know what that field is and displays a textbox for data
entry. How can I access the field in the subreport to do the calculation I
need?


It really isn't there when a subreport has no records. Use
this kind of expression to guard against the situation:

=IIf(subreport.Report.HasData, [hours billed] /
subreport.Report.[horus authorized], 0)
 
Back
Top