Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grouping in reports (sorry for double post)

Status
Not open for further replies.

ecannizzo

Programmer
Sep 19, 2000
213
US
I am trying to create a total # in my Group footer field of my report. I am doing this through code. My code is:

''''''''''''''''''''''''''''''''''''''
Dim TotalNum As Integer

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

TotalNum = TotalNum + Me.NO_PEOPLE

End Sub

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
Me.Total = TotalNum
TotalNum = 0
End Sub
''''''''''''''''''''''''''''''''''''''''
For some reason, sometimes it loops through the same records twice. Anyway, after every group I need the total to be zeroed out so that it can start a new running total. Any ideas why this is happening?

Thanks!
Erica
 
Create a Variable in your group headerprint = to the name of your group. Then put a If statement in your group headerformat, when a different group name is found, create a break to create a new group header which will also create a new group footer. Here's a sample from a report of mine.

Private Sub GroupHeader1_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
varEmpNo = "Emp ID #"
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
If &quot;Emp ID #&quot; <> &quot;&quot; Then
If varEmpNo <> &quot;Emp ID #&quot; And varFlag = 0 Then
GroupHeader0.Visible = True
Else
GroupHeader0.Visible = False
End If
End If
End Sub
 
have a database with following example values:

Dave tom 120
pip 200
sam 180
total 500 (3rd place)

Dick pip 200
nic 250
sam 180
total 630 (2nd place)

Rick nic 250
lil 175
tom 120
total 545 (1st place)

totals are calulated at report time, would like to sort by total, result : 1st, 2nd & 3rd place. any ideas, thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top