Form Controls

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
 
W

Wayne Morgan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top