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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternative background colour on report listing 1

Status
Not open for further replies.

n2nuk

IS-IT--Management
Dec 24, 2002
190
0
0
GB
Hi there,

I have a quite a large report which contains a number of columns and hundreds of rows over a 120 page report.

To make reading the listing easier, is there any way I could alternate the background colour for every other row in the report?

thanks in anticipation

Naz
 
see thread703-376558

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

    'Michael Red.   2/13/2002.      To 'Toggle the backolor, which
    'Provides alternate line shading
    Const XorToggle = 4144959

    Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle

End Sub



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Thanks for that,

It worked a treat! no doubt I will re-use this code in loads of other reports that I am writing.

Much appreciated and many thanks
Naz
 
You deserve a star. I would never come up to this simple and beautiful solution!
 
Work great for me too ! In less than 10 seconds, my reports looked ten times better !

:)
 
I was having trouble with this too. Thank You Michael!
To everyone else: If you want to use a different background color here is how to do that.
First, go to properties. Change the 'Back Color' to whatever color you want your highlight color to be (I like pale yellow). Make a note of the number displayed. Change the 'Back Color' back to whatever color you want your background to be. Make a note of this number too. Subtract the highlight color from the background color and replace 4144959 with that number. You code will look like this:

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

'Michael Red. 2/13/2002. To 'Toggle the backolor, which
'Provides alternate line shading
Const XorToggle = 8323072 '(Background color, white(16777215) - Highlight color, yellow(8454143) = 8323072

Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle

End Sub

See it's just that easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top