Click to See Complete Forum and Search --> : Access Report (highlighting)


E Jorgensen
March 28th, 2001, 09:29 AM
I am using the following code to highlight the deatil section of an access report for every other record. I would like to be able to highlight every two records. Any suggestions

Option Explicit
Dim fGray As Boolean
Dim intvalue As Integer


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If intvalue Mod 2 = 0 Then Call AlternateGray

End Sub


Private Sub AlternateGray()
Const adhcColorWhite = &HFFFFFF
Const adhcColorGray = &HC0C0C0

' If the current section is to be printed in gray, then set
' the BackColor property for the section. This works only
' because the controls on the section are all set to
' be transparent.
Me.Section(0).BackColor = IIf(fGray, adhcColorWhite, adhcColorGray)

' Next time, do it the opposite of the way you did it this time.

fGray = Not fGray
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
fGray = True
End Sub