I have a parent report called rptClientCareAll. It is made up of 3 subreport controls. The user has the option to hide the detail of one of the subreports (if it's relevant, this is the code used to hide the subreport's detail: me.detail.visible = false
).
Problem #1: When I open the subreport independently of the parent report (sometimes the report will be shown as an independent report and sometimes shown as a subreport, so I need it to work in both situations), the detail is hidden, but the report is not "repainted"--so, the report looks a mess because the footer is now shown right below the header but the detail is not "erased" from the screen. How can I "repaint" the report so that the detail is removed? It's possible to repaint forms, but I cannot seem to repaint a report.
Problem #2: When I open the parent report and then opt to hide detail on the subreport, the detail is correctly hidden and "erased" (unlike in Problem #1 above; weird!), but, the subreport does not shrink in size, so, the whole point of hiding the detail is lost because there's this huge span of blank space on the parent report where the detail of the subreport used to appear. How can I get the subreport to shrink when the detail is hidden? I've tried setting all reports' (both parent and subreports) detail sections' Can Grow and Can Shrink properties set to Yes, but that doesn't help.
Note: I am showing the reports in acReportView, not acViewPreview. Seems like that might make a difference to what events are triggered?
So, basically Problem #1 (report is opened independently, not as a subreport) is solved by a simple Me.Requery after the user opts to hide the detail section.
Problem #2 apparently cannot be solved without closing and reloading the report, which was a bit easier to say than to do in my case.
For my situation, I added code to do the following:
It's clunky, but it was the only way I could find to accomplish hiding and shrinking the detail section on demand.