trying to add a new page....

Posted by: kmac303 on 4 August 2017, 2:46 pm EST

  • Posted 4 August 2017, 2:46 pm EST

    I have a report that has a subreport within it. Inside that subreport I am keeping a page count based on the record count(code below). What I am trying to do is insert a blank page to make it even pages. We are printing two-sided pages, so if I have 3 pages it throws off printing, so that is why I need another blank page in there. I have tried both of these(in red).

    Private Sub ActiveReport_ReportEnd()
        If (pageCount Mod 2) = 0 Then
            'Detail.NewPage = ddNPAfter
            'arQwestSub2.Pages.Add

            pageCount = 0
        End If
    End Sub

    Private Sub ActiveReport_ReportStart()
        intCount2 = 0
        pageCount = 1
    End Sub

    Private Sub Detail_Format()
    intCount2 = intCount2 + 1

    If intCount2 = 40 Then 'If there are 6 records in the column
                'it will add a new column and reset the counter
        'Detail.NewColumn = ddNPAfter
        Detail.NewPage = ddNPAfter
        intCount2 = 0
        pageCount = pageCount + 1
    Else
        'Detail.NewColumn = ddNPNone 'This turns off the Add New column
        Detail.NewPage = ddNPNone
    End If

    End Sub

  • Replied 4 August 2017, 2:46 pm EST

    I was able to successfully accomplish what I believe you are attempting to do by adding the following lines of code to the main/parent report's Detail AfterPrint event. I didn't take the time to see how this affects any footers or if you have more than one detail section per page.


    Private Sub Detail_AfterPrint()
        If Me.Pages.Count Mod 2 = 1 Then
            Me.Pages.Add
        End If
    End Sub
Need extra support?

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

Learn More

Forum Channels