Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change source object of a sub report

Posted on 2013-06-11
3
Medium Priority
?
588 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

609 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