Change colour in reports?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to dynamically change the back colour of a report text box
through code? For example, my report groups the recordset by a "colour"
field (values of Red, Green, Yellow). Is there a way to change the back
colour of this field based on it's value? Thanks.
 
REC said:
Is it possible to dynamically change the back colour of a report text box
through code? For example, my report groups the recordset by a "colour"
field (values of Red, Green, Yellow). Is there a way to change the back
colour of this field based on it's value?


Use the text box section's Format (or Print) event to run
code like:

Select Case Me.txtColor ' text box for colour field
Case "Red"
Me.txtColor.BackColor = RGB(255, 0, 0) 'Red
Case "Green"
Me.txtColor.BackColor = RGB(0, 255, 0) 'Green
Case "Yellow"
Me.txtColor.BackColor = RGB(255, 255, 0)
Case "Pink"
Me.txtColor.BackColor = RGB(255, 224, 224)
. . .
Case Else
Me.txtColor.BackColor = RGB(255, 255, 255) 'White
End Select
 
Many thanks!

Marshall Barton said:
Use the text box section's Format (or Print) event to run
code like:

Select Case Me.txtColor ' text box for colour field
Case "Red"
Me.txtColor.BackColor = RGB(255, 0, 0) 'Red
Case "Green"
Me.txtColor.BackColor = RGB(0, 255, 0) 'Green
Case "Yellow"
Me.txtColor.BackColor = RGB(255, 255, 0)
Case "Pink"
Me.txtColor.BackColor = RGB(255, 224, 224)
. . .
Case Else
Me.txtColor.BackColor = RGB(255, 255, 255) 'White
End Select
 
Back
Top