I have a report that can have any number of records based on the user’s selections. We need to force a page break so that only two records appear per page. Unfortunately Sorting/Grouping does not work because of the nature of the report data. However, I was able to put a page break control in the detail section and switch it on and off with code as follows.
Option Compare Database
Option Explicit
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intEvenPage As Integer
intEvenPage = Me.txtRecordCounter.Value Mod 2
If intEvenPage = 0 Then
Me![CondPgBreak].Visible = True
End If
End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me.CondPgBreak.Visible = False
End Sub
Now the problem. Whenever there is an even number of records, we get a blank page on the end of the report. How can I eliminate that last blank page?
(editorial comment) This is why I dislike using the page break control. I start thrashing.
Thanks all,