Highlight Rows (Sort)

T

tvh

I have entered the following code to highlight alternate rows in a few of my
reports:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
m_RowCount = m_RowCount + 1
If m_RowCount / 2 = CLng(m_RowCount / 2) Then
Me.Detail.BackColor = 16777215 'Change value to the color you
desire
Else
Me.Detail.BackColor = 15790320 'Change value to the color you
desire
End If
End Sub

However, I would now like one of my reports to alternately highlight rows
that are grouped by the Date field. ie, all records in the report for
05/01/05 would be gray, 05/02/05 would be white, 05/03/05 gray again, etc.
etc.
Is there a way to change the code above, or would it be something completely
different?

Thanks,
TVH
 
G

George Nicholson

Same idea, just relocate it to the GroupHeader.

Increment a variable (m_GroupCount) in the Group Header so that it changes
when the date does.
Then you can change the detail background using the same logic you do now
(is mGroupCount odd or even?). You can do all of this from the GroupHeader
rather than row-by-row in the Detail.

HTH,
 
Top