# Question about formatting Access reports

**URL:** <https://boards.straightdope.com/t/question-about-formatting-access-reports/118935>\
**Category:** Factual Questions\
**Created:** [July 14, 2002, 6:45pm UTC](https://boards.straightdope.com/t/question-about-formatting-access-reports/118935 "2002-07-14T18:45:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSexton](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@JSexton](https://boards.straightdope.com/u/JSexton)\
**Post date:** [July 14, 2002, 6:45pm UTC](https://boards.straightdope.com/t/question-about-formatting-access-reports/118935/1 "2002-07-14T18:45:59Z")

</div>

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.

Justin

---

<div class="post-metadata">

**Author:** ![K364](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/k364/32/5_2.png) [@K364](https://boards.straightdope.com/u/K364)\
**Post date:** [July 14, 2002, 7:31pm UTC](https://boards.straightdope.com/t/question-about-formatting-access-reports/118935/2 "2002-07-14T19:31:32Z")

</div>

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:

```auto

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)
Else
    Me.Detail.BackColor = RGB(200, 200, 200)
End If

Counter = Counter + 1
End Sub
End Sub

```

---

<div class="post-metadata">

**Author:** ![JSexton](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@JSexton](https://boards.straightdope.com/u/JSexton)\
**Post date:** [July 14, 2002, 7:37pm UTC](https://boards.straightdope.com/t/question-about-formatting-access-reports/118935/3 "2002-07-14T19:37:38Z")

</div>

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

Justin
