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 grey lines in header

Status
Not open for further replies.

icsupt

MIS
Jun 14, 2004
150
US
I am trying to add alternate grey lines to a header. The reason I am using a header is because I'm using the header for summary information. I made the detail section not visible.

I looked on FAQ and it has this, which works in the detail section. I need to make my line alternate grey in the Header2 section. Does anyone know how to do this?

faq703-2684

You may want to make a report easier to read by having alternating gray lines. To do this, go to your report's properties and add an event procedure to your On Format of your detail section. The constant can be changed to whatever color you want (a quick way to get the number is to choose a background color in one of your forms, and then copy the number and paste it in code).

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

Const vbLightGrey = 14540253

If Me.CurrentRecord Mod 2 = 0 Then

Me.Section(acDetail).BackColor = vbLightGrey

Else

Me.Section(acDetail).BackColor = vbWhite

End If

End Sub
 
Have you tried it at all?

Replace "Section(acDetail)" with the name of your header.
 
Yes I did, but it didn't work. The header name is GroupHeader5, so I put in "acGroupHeader5".
 
I tried it an it worked perfectly.
Code:
  Const vbLightGrey = 14540253

    If Me.CurrentRecord Mod 2 = 0 Then

      Me.GroupHeader5.BackColor = vbLightGrey

   Else

      Me.GroupHeader5.BackColor = vbWhite

   End If

also, when I've used this, the 'light grey' prints pretty dark, so I use the pale yellow instead. Just a suggestion in case the same happens to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top