You've probably seen tables with alternating row colors in some applications. The alternating row colors are normally added for readability purposes. You would notice that wide tables with multiple columns are easier to read when the colors of their rows are alternate.
Let's make the row color alternate between two colors: silver and yellow.
BackgroundColor
property and set it to an expression (from the drop-down list select Expression).=IIF(RowNumber(Nothing) Mod 2 = 0, "Silver", "Yellow")
In previous example, the IIF
function is a decision function that returns a Boolean Value (True
or False
) depending on the criteria (whether it's true or False). For more info about the IIF
function, check this link: http://msdn.microsoft.com/en-us/library/ms157328.aspx#DecisionFunctions
Moreover, the RowNumber
function retrieves the row number of the current row. The Nothing
keyword indicates that we want to start our row count at the top of our table. For more information about the RowNumber
function, check this link: http://msdn.microsoft.com/en-us/library/ms157328.aspx#RowNumber
The MOD
is an arithmetic operator that returns the remainder (integer) of a division.
Let's take a look at our report in action:
3.133.134.151