Alternate Gray Bars on My Reports

Problem

You have some reports on which you’d like to print alternate rows with gray bars in the background. Printing these bars makes the reports easier to read, especially when there’s lots of data or the report is very wide. Is there a way to create these bars in Access?

Solution

There are a number of ways to print alternate rows with gray and white backgrounds. The simplest method is to alternate the background color of the detail section for each new record. This solution shows you how to use this method to achieve the desired effect on your reports.

To create your own reports with alternating gray bars in the detail section, follow these steps:

  1. Create your report. Because this method will fill the entire detail section with gray shading, the effect will work best if your detail section is one line high. (It will work with taller detail sections, but it won’t look as good.)

  2. Make sure that every control in the detail section has its BackStyle property set to Transparent. You can quickly change this property for all the controls in the section by marquee-selecting all the controls and then changing the BackStyle property in the properties sheet, which will now have the title Multiple Selection (see Figure 3-28).

    Changing all the controls’ BackStyle properties in one operation

    Figure 3-28. Changing all the controls’ BackStyle properties in one operation

  3. Edit the report’s module (click on the Code button on ...

Get Access Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.