Hi,
I have a report grouped by Municipality. Within each grouping I am counting the # of records in the group, as well as keeping a count for the total # of records in the report.
I do my counting in the Detail_Print event (see code below). When I had this code in the Detail_Format event, I would get the count wrong when a group spanned more than one page. It is now working in the Detail_Printe vent for the group, but the totalCounter for the report always ends up at zero now.
I don't understand why it is always ending up at zero. Any ideas??
I have a report grouped by Municipality. Within each grouping I am counting the # of records in the group, as well as keeping a count for the total # of records in the report.
I do my counting in the Detail_Print event (see code below). When I had this code in the Detail_Format event, I would get the count wrong when a group spanned more than one page. It is now working in the Detail_Printe vent for the group, but the totalCounter for the report always ends up at zero now.
I don't understand why it is always ending up at zero. Any ideas??
Code:
Option Compare Database
Dim counter As Integer
Dim totalCounter As Integer
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
counter = counter + 1
totalCounter = totalCounter + 1
End Sub
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
lblTotal.Caption = "Total Sites for " & Municipality & ": " & CStr(counter)
End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
counter = 0
End Sub
Private Sub Report_Open(Cancel As Integer)
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
lblReportTotal.Caption = "(Total # of Sites on this Report: " & CStr(totalCounter) & ")"
End Sub
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
totalCounter = 0
End Sub