Question about formatting Access reports

Is it possible to format a report in Access such that every other line has a 10% shaded background? It’s a snap to do in Excel, but I can’t find any way to do it in Access. I can’t even fathom how to code such a thing in the Detail section code.

Any Dopers have an idea? This is in Office 200 pro, by the way. Thanks in advance.


In design mode of the report, right click on the bar over the detail section. Choose “Build Event” and use the code builder. By default, you will now be in Visual Basic looking at an empty “Detail_Format” Event for the report. Type in the following:

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

Static Counter As Integer
If Counter Mod 2 = 0 Then
    Me.Detail.BackColor = RGB(240, 240, 240)
    Me.Detail.BackColor = RGB(200, 200, 200)
End If

Counter = Counter + 1
End Sub
End Sub

I love this place. Thanks, K364, you are a lifesaver.