Conditional Formatting

  • Thread starter Thread starter Mr-Re Man
  • Start date Start date
M

Mr-Re Man

I have a continuous form where records can be in either 1 of 3 states (Red
Amber or Green)

I can conditionally format all the fields using expression to have the same
colour but I would like to change the background colour of the Detail section
to also go red, amber or green.

Is this possible? and if so could you provide me with some code please :)
 
Mr-Re Man said:
I have a continuous form where records can be in either 1 of 3 states (Red
Amber or Green)

I can conditionally format all the fields using expression to have the
same
colour but I would like to change the background colour of the Detail
section
to also go red, amber or green.

Is this possible? and if so could you provide me with some code please :)

Here's some air code:

Private Sub Form_Current()
Select Case SomeField.Value
Case 1
Me.Section(0).BackColor = vbRed
Case 27
Me.Section(0).BackColor = vbGreen
Case Else
End Select
End Sub
 
Thanks Arvin, I tried the 'air code' with no joy, but tweaked it a little and
ended up with this, I don't know if it is valid, but all the continuous sub
form rows are green.

The ColoursID box is text, rather than an ID number, I set it up this way in
the Table using Lookup Wizard.

Private Sub Form_Current()
Select Case ColoursID.Value
Case 1
Me.Section(Red).BackColor = vbRed
Case 2
Me.Section(Amber).BackColor = vbGold
Case 3
Me.Section(Green).BackColor = vbGreen
Case Else
Me.Section(0).BackColor = vbWhite
End Select
End Sub

I also noticed that when no colour was selected the subforms Form Header
section went Green.

tia
 
Back
Top