Conditional formatting from checkbox (1 Viewer)

82412

Registered User.
Local time
Today, 05:45
Joined
Dec 15, 2006
Messages
25
In one of my forms I have used this code in the properties of a check box (with the names changed) to apply conditional formatting to a text box when the checkbox is ticked:


Private Sub Check14_AfterUpdate()
If Me!Check14 = True Then
Me!txtDesc.BackColor = vbRed
Me!txtDesc.ForeColor = vbBlack
Else
Me!txtDesc.BackColor = vbWhite
Me!txtDesc.ForeColor = vbRed
End If
End Sub




It works perfectly, except that when I apply a change to one record the same colour change is applied to all records in the form regardless of whether or not the checkbox has been ticked. What am I missing?
 

RuralGuy

AWF VIP
Local time
Yesterday, 22:45
Joined
Jul 2, 2005
Messages
13,825
It sounds like you have a continuous form. Use Conditional formatting on the txtDesc control if the CheckBox is a bound control.
 

boblarson

Smeghead
Local time
Yesterday, 21:45
Joined
Jan 12, 2001
Messages
32,059
And by Conditional Formatting, RG is saying to select the txtDesc box and in design view go to the menu bar and select Format > Conditional Formatting. You would need to use the Expression Is instead of Value Is from the drop down.
 

82412

Registered User.
Local time
Today, 05:45
Joined
Dec 15, 2006
Messages
25
Thanks guys, sorry for the late reply, been off with flu. Problem Sorted.
 

Users who are viewing this thread

Top Bottom