Form Color Problem

A

Allen

I have a Form with a subform that is in a continues view.
In the subform I wanted a TextBox to change colors
depending on a value of another box. This is my code.

Private Sub Form_Current()

If [OPS] = 1 Then
[TBC].Visible = False
End If
If [OPS] = 2 Then
[TBC].BackColor = 13434828
[TBC].Visible = True
End If
If [OPS] = 3 Then
[TBC].BackColor = 9868950
[TBC].Visible = True
End If
If [OPS] = 4 Then
[TBC].BackColor = 52479
[TBC].Visible = True
End If
If [OPS] = 5 Then
[TBC].BackColor = 16751052
[TBC].Visible = True
End If
If [OPS] = 6 Then
[TBC].BackColor = 13421619
[TBC].Visible = True
End If
If [OPS] = 7 Then
[TBC].BackColor = 65535
[TBC].Visible = True
End If

End Sub

The problem what I am having is if you don't have focus
on one of the fields they all have the same color. but
when you show focus on one of the fields, it shows the
color it suppose to. How can I make it show the colors to
were they are not all the same color. when I show focus
on a field, then the rest show the same color. How can I
stop that form happening, and I want them to show
different colors when needed. Is there any way to fix
that?
 
A

Allen Browne

Use Conditional Formatting.
It's on the Format menu in form design view.
(Assumes Access 2000 or later.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top