Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    settting alternative background colour on report (2000/XP)

    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

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: settting alternative background colour on report (2000/XP)

    First, set all of the controls to transparent in the detail section. Then set the detail background to light gray.

    In the OnFormat property of the report, enter the following

    Option Explicit
    Dim fGray As Boolean
    ____________________________________________
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Call AlternateGray
    End Sub
    ____________________________________________

    Private Sub AlternateGray()

    Const adhcColorGray = &HC0C0C0
    Const adhcColorWhite = &HFFFFFF
    Me.Section(0).BackColor = IIf(fGray, adhcColorGray, adhcColorWhite)

    fGray = Not fGray
    End Sub

  3. #3
    New Lounger
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: settting alternative background colour on report (2000/XP)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •