Subreport slows down the report formatting

M

Mike

In my database I have a report with a subreport (“repSubRepâ€) in one of the
main report group header. I would like the subreport to be visible only if
the value of a certain text box (“PLSGroupID“) in the group header is equal
to 9:

Private Sub MainLevelHeader_Format(Cancel As Integer, FormatCount As Integer)
If Me.PLSGroupID = 9 Then
Me.repSubRep.Report.Visible = True
Else
Me.repSubRep.Report.Visible = False
End If
End Sub

The above code works fine. But in spite of that the subreport is not visible
in most of the grops, the recordsource query of the subreport runs every time
while formatting the MainLevelHeader which slows the report preview process
dramatically.

Is it possible to make something so that the recordsource query of the
subreport would run ONLY when the subreport is visible?

Thank you in advance for any tips!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top