Hi
I have a form, that lists a number of students including a Yes/no -checkbox to each student. If the checkbox isnīt checked, I want the color of the students name to turn red. Whatīs the code for that?
Thx in advance
Hi
I have a form, that lists a number of students including a Yes/no -checkbox to each student. If the checkbox isnīt checked, I want the color of the students name to turn red. Whatīs the code for that?
Thx in advance
I am attaching a sample. I have two codes one attached to the On Current Event of the Form and the other on the AfterUpdate Event of the Form. The code on the OnCurrent event ensures that the color is indicated on the Loading of the form according to the value of the CheckBox. Adding Case = Null ensures the color is same when the Value is unchecked.
Private Sub Check5_AfterUpdate()
Select Case Me.Check5
Case Is = True
Me.Text3.BackColor = RGB(225, 0, 0)
Case Is = False
Me.Text3.BackColor = RGB(0, 225, 0)
End Select
End Sub
Private Sub Form_Current()
Select Case Me.Check5
Case Is = Null
Me.Text3.BackColor = RGB(0, 225, 0)
Case Is = True
Me.Text3.BackColor = RGB(225, 0, 0)
Case Is = False
Me.Text3.BackColor = RGB(0, 225, 0)
End Select
End Sub
See tha Sample attached.
if this solves your problem mark the thread solved.
Great! But when I change the standard show for the form as you can see on attachment. The color changes for everyone, and not just for the entry unchecked..
Check if this solves your problem.
chack this one too: if you problem is solved mark the thread solved.
The easiest way to do this (if Max's Edits don't work, which they probably will) would be to use Conditional Formatting.
Select the Field with the information you want to highlight red then go to the Format Menu -> Conditional Formatting.
Change the field that says "Field value is" to "Expression"
Enter [myCheckBox]=No (do not put quotes around the word "No")
Use the Format to whatever you want.
This will change the format of that field to whatever you select on a Record by Record basis so ONLY the Records where myCheckBox is No/False will be formatted.
"(if Max's Edits don't work, which they probably will)"
Rawb probably you should have checked the samples attached after I posted the code I have used conditional formatting in them. The code that I posted will work in a single Form and not in a continous form.