Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting

Status
Not open for further replies.

Daina

Technical User
Dec 5, 2001
14
AU
Hi,

In my form I have a combo box with Comply, Does not comply & Not applicable as possible selections. I want the selection "Does not comply" to appear red and the other 2 selections to remain black.

I have added the below expression and it seems to work when adding and editing records, except when the form is closed and re-opened "Does not comply" goes back to black and remains that way how can I get this to remain as it is entered and appear this way on the datasheet?

Private Sub Ctl_S7__Did_the_EHO_inform_the_occupier_someone_was_smoking__Click()
If Not [(S7) Did the EHO inform the occupier someone was smoking?] = "Does not comply" Then
Me.[(S7) Did the EHO inform the occupier someone was smoking?].ForeColor = 0 '0 = black
Else
Me.[(S7) Did the EHO inform the occupier someone was smoking?].ForeColor = 255 '255 = red
End If
End Sub
 
Hi!

Put the same code in your Form_Current Event procedure. Every time the form changes records the Form_Current procedure runs and it will change the combo box to the appropriate color.

hth Jeff Bridgham
bridgham@purdue.edu
 
Jeff,

Ok thanks I will try that

Daina
 
Jeff,

Thanks it worked a treat

Daina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top