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!

Change Row Color every 'x' rows in Report Footer 1

Status
Not open for further replies.

photoguy53

Technical User
Jun 29, 2005
5
US
Have been searching a while on this and other forums for a solution to this problem:

I have a report that shows 79 rows of ranked data, only it all appears in the GroupFooter section. (Got rid of the Detail Section, for various reasons). I've been exploring forums to try and find a way and/or code to have it shade the rows in groups of 10. In other words, the first 10 rows on the report would be for example yellow, the next 10 light blue, the 3rd set of ten light green, and then repeat or just the default white. I've seen some posts for alternating the color of rows, and even changing the color every 'x' rows, but all have been done in the DETAIL section. I've trying copying the code and playing with it, but can't seem to get it to work in the GroupFooter section.

Any ideas would be greatly appreciated! If this isn't an adequate description of what I'm looking to do, just ask me more! By the way I'm using Access 2003. I've tried the following code in both the OnFormat and OnPrint Expressions to no avail. Maybe someone could take a look to see if I'm doing something wrong here?

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Lines
End Sub
Private Sub Lines()
Const cGray = &HF0F0F0
Const cWhite = &HFFFFFF

Dim Color As Long
Dim CTL As Control
Dim i As Integer
Static MyCount As Integer

MyCount = MyCount + 1
Select Case MyCount
Case 1 To 5: Color = cGray
Case 6 To 10: Color = cWhite
Case Else: Color = cGray: MyCount = 1
End Select

For i = 0 To Me.Count - 1
Set CTL = Me(i)
If CTL.Section = 8 Then CTL.BackColor = Color
Next
End Sub

Thanks again!
 
An issue here would be wheather all of the records appeas in the same pass. If they do, then the code you posted should be at least sufficient to step throuogh and see whqat issues you are having. If the records appear from different group 'passes", you will need to keep track of the record count for the group overall and reference that value vs, the "MyCount" variable.

Keeping track of the recordcount for the group footer will depend on the structure of the report.

Since I'm sure you wont believe me re the seperate maintenance of the recordcount, you can also use ye olde debugger to look at you variable at hte entry point of you group footer format procedure.



MichaelRed


 
Thank you Michael, that seems to be the logical solution, to keep track of the record count for the group. I'll have to resort to the debugger!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top