-
1
- #1
So I have the following code added to a check box on a continuous form.
Private Sub Check32_Click()
If Me.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)
Else
Me.Sender_Comp_ID.BackColor = RGB(255, 255, 255)
Me.Port.BackColor = RGB(255, 255, 255)
End If
End Sub
The code is successful in changing the color of the field upon clicking the checkbox; however, all records change colors when 1 single checkbox is clicked. Please help me revise the code to make it so each checkbox for each entry is unique! I know this needs conditional formatting.
I tried the following but was unsuccessful:
Dim objFrc As FormatCondition
Dim lngGreen As Long
lngGreen = RGB(0, 255, 0)
Me.Sender_Comp_ID.FormatConditions.Delete
Set objFrc = Me.Sender_Comp_ID.FormatConditions.Add(Check32.Value = True)
With Me.Sender_Comp_ID.FormatConditions
.Add.BackColor = RGB(0, 255, 0)
End With
End Sub
Maybe I simply add the "FormatConditions.Delete" clause?
Private Sub Check32_Click()
If Me.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)
Else
Me.Sender_Comp_ID.BackColor = RGB(255, 255, 255)
Me.Port.BackColor = RGB(255, 255, 255)
End If
End Sub
Or add the clause to this that references parent form?
Private Sub Check32_AfterUpdate()
If Me.Parent.SESSIONS.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)
Private Sub Check32_Click()
If Me.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)
Else
Me.Sender_Comp_ID.BackColor = RGB(255, 255, 255)
Me.Port.BackColor = RGB(255, 255, 255)
End If
End Sub
The code is successful in changing the color of the field upon clicking the checkbox; however, all records change colors when 1 single checkbox is clicked. Please help me revise the code to make it so each checkbox for each entry is unique! I know this needs conditional formatting.
I tried the following but was unsuccessful:
Dim objFrc As FormatCondition
Dim lngGreen As Long
lngGreen = RGB(0, 255, 0)
Me.Sender_Comp_ID.FormatConditions.Delete
Set objFrc = Me.Sender_Comp_ID.FormatConditions.Add(Check32.Value = True)
With Me.Sender_Comp_ID.FormatConditions
.Add.BackColor = RGB(0, 255, 0)
End With
End Sub
Maybe I simply add the "FormatConditions.Delete" clause?
Private Sub Check32_Click()
If Me.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)
Else
Me.Sender_Comp_ID.BackColor = RGB(255, 255, 255)
Me.Port.BackColor = RGB(255, 255, 255)
End If
End Sub
Or add the clause to this that references parent form?
Private Sub Check32_AfterUpdate()
If Me.Parent.SESSIONS.Check32.Value = True Then
Me.Sender_Comp_ID.BackColor = RGB(0, 255, 0)
Me.Port.BackColor = RGB(0, 255, 0)