Dear CK,
There are two ways to do it, one with VB code (the "proper" way), and one
without, with a little trick. The funny thing is the code one is a lot
slower, and it becomes apparent in big reports!
Both ways rely on a line counter in the detail section of the report. To do
that, while in design view, add a new textbox, call it txt Counter and set
its ControlSource property to =1, and its Running Sum property to Over Group
(or over all, depending on how you want it to behave)! You can also set its
Visible property to No, so it doesn't show or print.
This done, the background is changed by examining the residue of the value
in txtCounter divided by 2 (which will always be 0 or 1).
Doing it through code, you would need something like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Counter Mod 2 = 0 Then
Me.Detail.BackColor = 12632256
Else
Me.Detail.BackColor = vbWhite
End If
End Sub
behind the Format event of the detail section (works great but slow).
Alternatively: add another unbound textbox in the detail section, with its
ControlSouce property empty (delete its label), and drag it to cover the
entire detail section area. While it's selected go Format > Send to Back (so
the data controls will always be on top), and then go Format > Conditional
Formatting; in the dropdown under Condition 1 select "Expression is", and
type the following expression next to it:
[txtCounter] Mod 2 = 0
Then right underneath, select the background colour you want ("bucket"
tool), and you're done!
HTH,
Nikos