?
Solved

Change source object of a sub report

Posted on 2013-06-11
3
Medium Priority
?
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39238442
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 2000 total points
ID: 39239876
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
ID: 39240601
Yes, it does work. I guess the help is not always correct!
Thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

764 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