ACC2000: Print Blank Line Every Nth Line in a ReportID: Q208696
|
This article shows you how to add blank lines between the printed lines on a report. You can use this method to add a blank line after a set number of lines. For example, you could use this method to add a blank line after every five lines of data in your report.
CAUTION: Following the steps in this example will modify the sample
database Northwind.mdb. You may want to back up the Northwind.mdb file
and perform these steps on a copy of the database.
To add a blank line after every five lines in a report, follow these steps:
Option Compare Database
Option Explicit
' This code declares the cLines variable as an integer, and the
' cMaxLine constant as five. You can set the cMaxLine constant
' to insert a blank line after as many lines as you want. For
' example, to add a blank line after every eight lines in the
' report, set cMaxLine=8.
Dim cLines As Integer
Const cMaxLine=5
Private Sub Report_Open (Cancel As Integer)
'This code initializes the cLines variable to zero.
cLines = 0
End Sub
Private Sub Detail_Format (Cancel As Integer, FormatCount As _
Integer)
' This code adds a blank line by setting the NextRecord and
' PrintSection properties.
If cLines Mod (cMaxLine+1) = 0 Then
Me.NextRecord = False
Me.PrintSection = False
End If
cLines = cLines + 1
End Sub
For more information about the NextRecord property, click Microsoft Access Help on the
Help menu, type "NextRecord property" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
For more information about the PrintSection property, click Microsoft Access Help on the
Help menu, type "PrintSection property" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
Additional query words:
Keywords : kbdta RptLayou
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 10, 1999