Conditional formatting from checkbox

82412

Registered User.
Local time
Today, 15:23
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?
 
It sounds like you have a continuous form. Use Conditional formatting on the txtDesc control if the CheckBox is a bound control.
 
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.
 
Thanks guys, sorry for the late reply, been off with flu. Problem Sorted.
 

Users who are viewing this thread

Back
Top Bottom