Change Color of records

  • Thread starter Thread starter Gregory Stapleton
  • Start date Start date
G

Gregory Stapleton

Is there a way to change the color of fields in a record,
depending on the value within the field, as you view
records either in form view or datasheet view? I can't
figure out which event will be triggered (oncurrent?) so
that I can evaluate a field's value and then set the
backcolor.
 
I answered my own question: I was using an invalid value
to check for color change. When I fixed that, it works
fine on the oncurrent event. Unfortunately, as has always
been the case, it won't work in datasheet view or
continuous forms view. I was able to get it to work with
conditional formatting, but I need more than just the
three available conditions, sadly.
 
I got this from one of the MVPs. It reverences font
weight not color but I think you will get the jest.

Jim

Forms Conditional Formatting base on value
.. Do it on code:
Private Sub cboMyCombo_AfterUpdate()
Me.txtBox1.FontWeight = IIf(Me.cboMyCombo
= "value1", "Normal","Bold")
Me.txtBox2.FontWeight = IIf(Me.cboMyCombo
= "value2", "Normal","Bold")
Me.txtBox3.FontWeight = IIf(Me.cboMyCombo
= "value3", "Normal","Bold")
Me.txtBox4.FontWeight = IIf(Me.cboMyCombo
= "value4", "Normal","Bold")
Me.txtBox5.FontWeight = IIf(Me.cboMyCombo
= "value5", "Normal","Bold")
Me.txtBox6.FontWeight = IIf(Me.cboMyCombo
= "value6", "Normal","Bold")
End Sub
 
Back
Top