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

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
 
M

Marshall Barton

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top