Access VBA

css navigation by Css3Menu.com

Alternating Report Color Rows

This example causes the rows in the report to be alternating in Pink, White, and Blue. Change the RGB values around to find your favorite.

The code goes into the Build Event for the DETAIL. In the case of a particularly long or detailed report, 3 colors really beats all white.

Private RowNumber       As Long

 

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    RowNumber = RowNumber + 1
    If RowNumber Mod 4 = 1 Then
        Me.Detail.BackColor = RGB(255, 204, 204) 'Pink
    Else
        If RowNumber Mod 2 = 1 Then
            Me.Detail.BackColor = RGB(204, 204, 255)
        Else       'Blue

            Me.Detail.BackColor = vbWhite
        End If
    End If
End Sub

Remember, change the background of the fields to Transparent so the color shines through.

© 2008-2024

Updated:  01/23/2024 13:34
This page added:  26 October 2008