Solved Subreport on page footer based on criteria (1 Viewer)

J_Fo

New member
Local time
Today, 17:59
Joined
Jan 3, 2024
Messages
6
Hello - I know that I'm not looking at this clearly and could use some direction. I have a report that includes a subreport in the footer. The subreport in the footer to be displayed when printed is based on 1 of 2 senarios that I have outlines below. I have also included a couple of my approaches (code) to solving the issue. Thanks Jen

The 2 sub reports
1. FooterSubData_subreport (uses a query)
2. FooterSubBlank_subreport (blank grid - no queried results)

The 2 senario's I'm working with:
1. If the FooterSubData_subreport report doesn't return results then ALL report pages should display FooterSubBlank_subreport
2. If the FooterSubData_subreport returns results then
Page 1 of the report should display FooterSubData_subreport and all subsequent pages should display FooterSubBlank_subreport

This approach works great as long as the FooterSubData has data:
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)

    Me.FooterSubData.Visible = Me.Page= 1
    Me.FooterSubBlank.Visible = Me.Page> 1

End Sub

I have tried multipule versions using the HasData in an IF statement and I can get one senario to work and then the other doesn't - this was one of the simple ones:

Code:
If Me.FooterSubData.Visible = Me.FooterSubData.Report.HasData Then
   Me.FooterSubBlank.Visible = True
   'Me.FooterSubData.Visible = False
Else
    Me.FooterSubData.Visible = Me.Page = 1
    Me.FooterSubBlank.Visible = Me.Page > 1
End If
 
I notice that you have not yet received a reply to your question. I am bumping it up the list so that it gets a second look...
 
Thanks Uncle Gizmo. I'm marking it as resolved. I hacked a solution until I can spend more time figuring out how to code it so it works.
 

Users who are viewing this thread

Back
Top Bottom