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

T

tina

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
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top