A running count on top of a page

  • Thread starter Thread starter Guest
  • Start date Start date
a running count of *what*? pages in the report? number of detail records in
a report? number of detail records in a report group? number of groups in a
report?
 
moustapha said:
How do I put a running count on the top of a page.
I'm sorry the question is how do I put a running count of detail records on
the top of a report
 
okay, i assume you really mean "a running count of detail records at the top
of *each page* of a report".

i couldn't figure out a way to put the count in the PageHeader section,
because the Print event runs for the PageHeader section of each page
*before* the event for the Detail section - which is where the records can
be counted. but you can put a running count of detail records in the
PageFooter section of the report by doing the following:

add an unbound textbox control to the report's PageFooter section, and name
it txtCount.
in the report's module, add a module-level variable, as

Dim lngCount As Long

add the following code to the report Detail section's Print event, as

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Not PrintCount = 2 Then
lngCount = lngCount + 1
End If

End Sub

add the following code to the report PageFooter section's Print event, as

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As
Integer)

Me!txtCount = lngCount

End Sub

hth
 
thanks alot.

tina said:
okay, i assume you really mean "a running count of detail records at the top
of *each page* of a report".

i couldn't figure out a way to put the count in the PageHeader section,
because the Print event runs for the PageHeader section of each page
*before* the event for the Detail section - which is where the records can
be counted. but you can put a running count of detail records in the
PageFooter section of the report by doing the following:

add an unbound textbox control to the report's PageFooter section, and name
it txtCount.
in the report's module, add a module-level variable, as

Dim lngCount As Long

add the following code to the report Detail section's Print event, as

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Not PrintCount = 2 Then
lngCount = lngCount + 1
End If

End Sub

add the following code to the report PageFooter section's Print event, as

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As
Integer)

Me!txtCount = lngCount

End Sub

hth
 
Back
Top