Setting SourceObject for a subReport

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

Guest

I have a Report with series of subReports. I want to change the
"SourceObject" of the subReports based upon a value on the main report. On
the Report's detail section (where the subReport reside), on the event
"Print" I wrote the following code.

If Me.TrafficCount > 0 then
Reports!ReportName!subReportName.SourceObject = "subReportOne"
Else
Reports!ReportName!subReportName.SourceObject = "subReportTwo"
End If

I must be missing the proper syntax to accomplish this task. If there is a
TrafficCount I want to print one subReport if the count is "0" I want to
print a different subReport.

Any help would be greatly appreciated. THANK!
 
I don't think you can do this in the OnPrint event. You'll have to do it in
the OnOpen event.

Barry
 
I will try by moving it to the OnOpen Event this evening when I am back at
the jobsite. So, you think the syntax is correct, only the Event was wrong?
 
Yes. The syntax looks correct. As you say, it's just the order of events
that's tripping you up.

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

Back
Top