Solved

Change source object of a sub report

Posted on 2013-06-11
3
539 Views
Last Modified: 2013-06-12
Hi
I have a report with a sub report. Using a form, the user can pick which subreport he wants displayed. Lets call them rptSub1, rptSub2, rptSub3.
In the code of the main report, I wanted to change the source object of the sub report, based on the option selected. For example
If Option1 = True Then
Me.rptSub.Sourceobject = "rptSub1"

Open in new window

But the Access help states
Note  You can't set or change the SourceObject property in the Open or Format events of a report.
So is there a different way to change the sub report?
Thanks
0
Comment
Question by:jdhackett
3 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
you have to open the report in the design view (using VBA.)
, change the SourceObject, close the report with option to save.

how are you opening the report? from a form?

post the code you are using to open the report.
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
Comment Utility
Note  You can't set or change the SourceObject property in the Open or Format events of a report.
That's interesting that it says that as I'm able to change the SourceObject of a subreport in either the OnLoad, OnOpen, and OnFormat events.  I just tried it right now.
0
 
LVL 1

Author Comment

by:jdhackett
Comment Utility
Yes, it does work. I guess the help is not always correct!
Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now