Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Setting SourceObject for a subReport

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Setting SourceObject for a subReport
cbjames 29.09.2006 00:07:01
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!


RE: Setting SourceObject for a subReport
Barry Gilbert 29.09.2006 01:59:02
I don't think you can do this in the OnPrint event. You'll have to do it in
the OnOpen event.

Barry

"cbjames" wrote:

[Quoted Text]
> 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!
>
>
RE: Setting SourceObject for a subReport
cbjames 29.09.2006 18:37:02
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?

"Barry Gilbert" wrote:

[Quoted Text]
> I don't think you can do this in the OnPrint event. You'll have to do it in
> the OnOpen event.
>
> Barry
>
> "cbjames" wrote:
>
> > 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!
> >
> >
RE: Setting SourceObject for a subReport
Barry Gilbert 29.09.2006 22:16:03
Yes. The syntax looks correct. As you say, it's just the order of events
that's tripping you up.

Barry

"cbjames" wrote:

[Quoted Text]
> 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?
>
> "Barry Gilbert" wrote:
>
> > I don't think you can do this in the OnPrint event. You'll have to do it in
> > the OnOpen event.
> >
> > Barry
> >
> > "cbjames" wrote:
> >
> > > 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!
> > >
> > >

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net