Form Controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I programatically change the color of all labels on a form except the
one being clicked.

For Each Ctl In Forms("frm_My_XFDP_Summary").Controls
If TypeOf Ctl Is Label Then
With
Ctl.ForeColor = RGB(0,0,0)
End With
Next ctl

I want the above code to be applied to all labels in the collection except
the one I am clicking on.

Thanks
 
Labels can't receive the focus and don't have a Click event. What are you
doing to execute this code?

In general, it would be

Dim ctl As Control
For Each ctl In Forms("frm_My_XFDP_Summary").Controls
If ctl.ControlType = acLabel Then
ctl.ForeColor = RGB(0,0,0)
End If
Next

but this will get all labels on the form.
 
Back
Top