gsc_dba (6/29/2010)
Private bOddRow As Boolean
'*************************************************************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'*************************************************************************
Function AlternateColor(ByVal OddColor As String, _
ByVal EvenColor As String, ByVal Toggle As Boolean) As String
If Toggle Then bOddRow = Not bOddRow
If bOddRow Then
Return OddColor
Else
Return EvenColor
End If
End Function
Then to use this on a table, add this to the expression on BackgroundColor:
=Code.AlternateColor("White", "Whitesmoke", TRUE)
Regarding this example, I was able to get the following to work for me:
BackgroundColor code for the rows:
=iif(RowNumber(Nothing) Mod 2,"White","Yellow")
If you want to use Report Code, though, I did this:
Function fToggleColor(ByVal bToggle As Boolean) As String
If bToggle Then
Return "White"
Else
Return "Yellow"
End If
End Function
with this in BackgroundColor:
=Code.fToggleColor(iif(RowNumber(Nothing) Mod 2,True,False))
I would be careful with RowNumber because I'm not fully aware of its behavior. I believe RowNumber would take the group name if there were groups involved. Not sure.