Report Line Banding in Microsoft Access
Program report banding in Visual Basic. Do you remember way back when you had large reports with and green stripped fan-fold computer paper? With today’s printers you’ll find it hard to get banded paper for your desktop printer – who needs it anyway when you can create the same report banding using a few lines of visual basic code within an Access database. The banded report lines make it easier for your eyes to follow across wide detail lines. Here’s a way for you to reproduce this changing line colors without having to buy the old fan-fold paper and you can choose any color – pastels only please.
Generating detail report line banding in an Access report is fairly easy once you see how to do it. After downloading the Access Report Banding Example:
Press the Open Report button below and you’ll see the report in print preview mode
Note the color banding of the detail lines in the report.
Place the report in design view. Then pick ‘View’ menu and then ‘Code’ . You’ll see the visual basic code used the create the banding.
Note the iline variable at the top of the code – this is a global variable (global to the report only). Iline is a boolean variable and therefore has two values – either true or false.
Note the event procedure On format for the Detail section of the report.
If the iline variable is true then the detail section back color is set to light blue. If the iline variable is false then the detail back color is set to white.
Note that the detail on format event procedure causes the iline variable to toggle back and forth from true to false – thereby changing the line colors.
Use this link to download the Access Database Report Banding example.
( Note that report banding has been incorporated into Access 2007 reports as a new property in the report property sheet. )