PrintCount Property
Applies To
Report.
Description
You can use the PrintCount property to identify the number of times the OnPrint property has been evaluated for the current section of a report.
Setting
You can use this property only in a macro or an event procedure specified by a section's OnPrint property setting.
The PrintCount property setting has a Long data type value.
This property isn't available in report Design view and is read-only in all other views.
Remarks
Microsoft Access increments the PrintCount property each time the OnPrint property setting is evaluated for the current section. As the next section is printed, Microsoft Access resets the PrintCount property to 0.
The PrintCount property is incremented, for example, when the KeepTogether property is set to No for the current section and the section is printed on more than one page. If you print a report containing order information, you might keep a running total of the order amounts. The following example shows how you can use the PrintCount property to make sure the value in the OrderAmount control is added only once to the running total:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If PrintCount = 1 Then
RunningTotal = RunningTotal + OrderAmount
End If
End Sub
In the previous example, RunningTotal can be a public variable or the name of an unbound control that is incremented each time a section is printed.
See Also
Event properties, FormatCount property, Print event.