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!

Color every other line in a report 2

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
US
Below is some code that I have that is supposed to add color
to every other line in a report. This code is working in
one of my Database reports but will not work in the report
I am trying to add it to now. This report is a Sub report.
Can anyone tell me what is wrong or have any other
suggestions.
Code:
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 = 15263976 'Change value to the color you desire
        Else
            Me.Detail.BackColor = 16777215 'Change value to the color you desire
    End If
End Sub
 
Where is m_RowCount defined? If it's inside the Detail_Format subroutine, it may be getting initialized to zero every time the subroutine is entered.
 
Might look crude but this works for me

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Section(0).BackColor = vbWhite Then
Me.Section(0).BackColor = 15724527 'gray
Else
Me.Section(0).BackColor = vbWhite
End If
End Sub
 
Code:
Me.Section("Detail").BackColor = Me.Section("Detail").BackColor Xor rgb(32, 32, 32)

Change the rgb valuse to suit your choice of colors. The sample provides a medium grey.




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top