Reports copied remain linked? (1 Viewer)

Hagridore

Agent of Creation
Local time
Today, 13:19
Joined
Feb 3, 2015
Messages
55
I have a report that I've created that contains a subreport for a particular year. I have copied that report and made year changes so that the new report should show the same statistics that the original report shows for one year for a different year. However, every time I change the subreport in one of these reports so that it shows the year that is supposed to be represented by this report when I go into the report I copied it has changed subreports, too. Is there a link between reports? It appears there must be, though I didn't set it up and didn't want to. If there is, how do I break it?

Thanks!
 

vbaInet

AWF VIP
Local time
Today, 22:19
Joined
Jan 22, 2010
Messages
26,374
Think of a subreport control as a door to the same house (the form itself). If you go in via any door it will lead to the same house. Any physical changes you make in the house can be seen by anyone entering the house through any of the doors. Hence, design changes made in a report will be seen as-is in a subreport control.

What you want to do is pass that Year criteria in the WhereCondition parameter of the OpenReport function. See here for an illustration:

http://www.techonthenet.com/access/reports/filter_rpt.php
 

Hagridore

Agent of Creation
Local time
Today, 13:19
Joined
Feb 3, 2015
Messages
55
Though the information in this reply is very interesting, and I'm likely to use it at some point, it doesn't answer my question, so let me be more specific and clear. I looked at what I wrote above and, if I didn't already know what it is I need to learn, I'm not sure I could've figured it out. Sorry...

I have a report which contains a subreport. Both of them relate to actions that have taken place in a particular year. The primary report contains statistics that summarize the year and the subreport contains a listing of all the specific records the statistics in the main report cover, showing only a handful of fields. When I got this form to work the way I wanted to for one year, I copied it, renamed it as relating to another year, made all the necessary changes so that that year was being searched for and referenced correctly in the code, and ran the report. I put these two reports on an menu/access screen, with buttons that clearly access their appropriate/respective year. I checked the code to be sure the right year was referenced in both buttons and then left things for awhile.

When I came back some time later, I discovered that the original report's year had changed to the same year as the copy. I changed it back to the year that was supposed to be represented. When I opened the copy, I found that it had changed to the year of the original. This is in spite of the fact that I double-checked the code again and clearly saw that it referenced the appropriate report and the two reports were appropriately named. It appears that my copying the one report from the other formed a link between them. Is this standard? Is there a way to break the link?
 

shoji

Registered User.
Local time
Today, 22:19
Joined
Feb 28, 2015
Messages
83
Hi Hagridore,

There are two areas you should check. One is the record source of the sub report. How do you set the year for this sub report? The other area is the Master Field and Child Field on the main report. Open the main report, then click the subreport once. Open the property sheets for the subreport control and check how the main report and sub report are linked. (Go to "Link Master Fields" and "Link Child Fields" on Data tab.)

If there is nothing wrong with them, we need more info about the situation or you could upload the simplified db.

Shoji
 

Hagridore

Agent of Creation
Local time
Today, 13:19
Joined
Feb 3, 2015
Messages
55
This is going to sound really dumb. However, they say confession is good for the soul, and in case anyone else ever runs into this situation, perhaps they can learn something from my unterbrilliance. It appears that when I copied the form for the newer year from the older year, it simply carried over the subreport from the older year. This means that each time I changed the various source properties, since there really was just one subreport, it ended up changed in both reports. I created a new subreport from scratch in the newer year report, and everything is working fine now.

I wonder...could I have saved myself some work by saving the subreport from the old year report as a new subreport and then just changing the few references to the specific year in the sources? Would this have kept all the formatting from the old subreport? I bet I can already hear the answer. And I know this makes me glad that there is no retesting for Mensa membership, and that "Densan" actions do not disqualify one, either.
 

Users who are viewing this thread

Top Bottom