I have a 2-column report with space on 8-1/2" X 11" landscape layout for 4 detail sections in each of the 2 columns. (Half-page layout) OpenArgs specifies how many detail sections are to be printed on the 1st half-page of the report. The code essentially keeps count of the sections printed on the 1st half-page and then skips any sections that are to remain blank. The report preview is as desired, but the printed page IS NOT skipping those same sections. Any ideas why that happens?
Thanks,
Bill
Code:
Option Compare Database
Option Explicit
Dim PageOneRemaining As Integer ' How many sections remain to be skipped on 1st Half-Page
Dim PageOneCount As Integer ' The number of sections to print on the 1st Half-Page.
Private Sub Report_Open(Cancel As Integer)
Me.Filter = "ClassID > 2"
Me.FilterOn = True
Me.OrderBy = "BkSortKey, LastName, FirstName"
Me.OrderByOn = True
PageOneCount = Me.OpenArgs ' How many Detail sections to print on the "1st Half-Page"
PageOneRemaining = 4 - PageOneCount ' Counter of how many remaining Detail sections to skip on "1st Half-Page"
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Len(Me.ClassPicture & "") > 0 Then
Me.Image.Picture = "c:\crs\images\" & Me.ClassPicture & ".jpg"
Else
Me.Image.Picture = "c:\crs\images\Default.jpg"
End If
End Sub
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PageOneCount = 0 And PageOneRemaining > 0 Then ' Potentially skipping sections 1st half-page only.
Me.PrintSection = False
Me.NextRecord = False
PageOneRemaining = PageOneRemaining - 1 ' Decrement sections skipped
Else
Me.PrintSection = True
Me.NextRecord = True
If PageOneCount > 0 Then PageOneCount = PageOneCount - 1 ' Decrement number of sections printed 1st half-page.
End If
End Sub