Hello
I wrote a few lines of code to apply conditional formatting to a combo box when its form is loaded. It doesn't quite work.
However if I then go to Layout view - Format - Conditional Formatting I can see the rules there. When I click on 'Apply' the form repaints with the conditional formatting applied.
What am I missing in the procedure?
The combo box is 'cmbAction'
Code:
Private Sub Form_Load()
Dim fc As FormatCondition
Me.cmbAction.FormatConditions.Delete
Set fc = Me.cmbAction.FormatConditions.Add(acExpression, acEqual, "[cmbAction] = Landing")
Set fc = Me.cmbAction.FormatConditions.Add(acExpression, acEqual, "[cmbAction] = Exercise")
Me.cmbAction.FormatConditions(0).BackColor = 100000
Me.cmbAction.FormatConditions(1).BackColor = 50000
Me.cmbAction.FormatConditions(0).Enabled = True
Me.cmbAction.FormatConditions(1).Enabled = True
Me.Repaint
End Sub