How use same report for two purposes

I have a main report that contains 3 subreports.  For the one purpose the report is working great.  But for the other purpose I want the same report but the report's subreports cannot show the information in the Report Header or Detail sections.

I'll run the report from a command button on a form.  How will I want to code this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
You can do this but it may be simpler just to make another sub report...
Jeffrey CoachmanMIS LiasonCommented:
Create a public module, and add in something like this:

    Public pubstrSubReportMode As String

On the Open event of the subform do something like this:
If pubstrSubReportMode = "NoDetail" Then
    Me.Section(0).Visible = False
End If

On the click event of the button that will open the form in this mode, do this:
    pubstrSubReportMode = "NoDetail"
    DoCmd.OpenReport "rptMain", acViewPreview

On the close event of the main report do something like this:
    pubstrSubReportMode = ""

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
..I am sure you could do this with 'Openargs", (and have it be a bit "safer")...

but this works...
glad I could help


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.