• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

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?

  • 3
1 Solution
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 = ""
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


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now