Subreport at a grouping level not appearing

Posted by: bkthomson on 4 August 2017, 2:39 pm EST

  • Posted 4 August 2017, 2:39 pm EST

    Situation I'm running into is at a grouping level I need to add a sub report.  I've looked at some examples and it seems like I have the correct code.  I have even stepped through the code and see that the Subreport does run, but when the main report is displayed the content from the subreport does not appear. 

    This looks like something that should be pretty straightforward, I have even validated that the visible flag is set to true.  When I call the show even on the sub report it opens in a new window and my content displays, but not within the main report.

    Below is the code I am using.  I would appreicate any suggestions one might have.

    Thanks,
        Brad

    Main Report


    Private Sub gfPropCode_BeforePrint()

       myPropID = Me.fldProp.Text

    Set SubReport1.object = New viaMonthlyBillingandPayment_Prop_Sub

    End Sub

    SubReport

    Declarations

        Private rsClone As ADODB.Recordset
        Public mySubPropID As String


    Private Sub ActiveReport_Initialize()

                Set rsClone = New ADODB.Recordset
                Set rsClone = viaMonthlyBillingandPayment.myCloneRS
                rsClone.Filter = "PropCode=" & viaMonthlyBillingandPayment.myPropID
                If Not rsClone.EOF Or Not rsClone.BOF Then
                        rsClone.MoveFirst
                End If

                Me.Label2.Caption = viaMonthlyBillingandPayment.myPropID

    End Sub

  • Replied 4 August 2017, 2:39 pm EST

    Try moving your set statement to the ReportStart event in your main report's code.

    Private Sub ActiveReport_ReportStart()
       Set SubReport1.object = New viaMonthlyBillingandPayment_Prop_Sub
    End Sub


    Also you do NOT need to use an Run or Show commands on the subreport, if it is properly attached to a subreport object the main/parent report will fire it automatically.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels