How to Color a Box on a Report when Change in one Field's Data

  • Thread starter Thread starter doyle60
  • Start date Start date
D

doyle60

I want to have a box on a report change it's back color from one color
to another and back again on every change in a field called
"CollectionCode."

The box is in the detail section. It is not in its own section for
stylistic reasons.

However, it is the first field listed in the sort.

Thanks,

Matt
 
I want to have a box on a report change it's back color from one color
to another and back again on every change in a field called
"CollectionCode."

The box is in the detail section. It is not in its own section for
stylistic reasons.

However, it is the first field listed in the sort.


That kind of thing is best done using grouping on the
CollectionCode field. Then you can use some VBA code in the
group header's Print event:

If Me.thebox.BackColor = RGB(r1,g1,b1) Then
Me.thebox.BackColor = RGB(r2,g2,b2) 'other color
Else
Me.thebox.BackColor = RGB(r1,g1,b1) 'one color
End If

If you do not want to see the group header, make it
invisible.
 
Back
Top