how do make all lines in a report alternate in shades of grey

  • Thread starter Thread starter Guest
  • Start date Start date
try

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

With Me.Section(acDetail)
If .BackColor = vbLightGrey Then
.BackColor = vbWhite
Else
.BackColor = vbLightGrey
End If
End With

End Sub

instead of the VBA color constants, you can use the numeric value of any two
colors you choose. by adding ElseIf conditions, you can rotate between three
or more colors.

hth
 
how do you do that in Access 2002????

I assume you mean all the Detail section rows.

The same way you do it in any other Access version.

Make sure the BackStyle of each control is Transparent.
Change the colors as needed.

Code the Detail Format event:

If Me.Section(0).BackColor = vbWhite Then
Me.Section(0).BackColor = 12632256 ' gray
Else
Me.Section(0).BackColor = vbWhite
End If

====
If you wish each page to start with a white row, code the Page Header
Format event:

Me.Detail.BackColor = 12632256 'Reset color to gray so that the
first detail line will become white
 
Back
Top