Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alternate colors in detail section of report 1

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
Sorry I have to bother you with this question, it is asked a lot of times, but can't find the right thread. Looking for an easy way to alternate colors in detail section of report.


Pampers.

You're never too young to learn
 
pampers
This reply assumes you want alternating gray and white shading.

1. Make sure your Detail section is one line high (can be taller but won't look as good with too much gray).
2. Set the BackStyle property of every control in the Detail section to Transparent.
3. In the code behind the report, put this in the Declarations area...
Code:
Dim fShade as Boolean
4. Put the following code on the OnPrint event of the Detail section...
Code:
Const acbcColorGray = 14540253
If fShade then
    Me.Detail.BackColor = acbcColorGray
Else
    Me.Detail.BackColor = vbWhite
End If
    'Alternate the value of fShade
fShade = Not fShade

5. If it matters whether the first row on the page is shaded, put the following on the OnPrint event of the report's page header...
Code:
fShade = False

Tom

 
Hi TOm,
tnx a lot. I've used it once in a test, but couldn't remember/find how to do it.



Pampers.

You're never too young to learn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top