Me.ActiveLabel ??

Treason

#@$%#!
Local time
Yesterday, 19:15
Joined
Mar 12, 2002
Messages
340
I created a makeshift calendar on one of my forms. The problem I used labels instead of textboxes. So I set the caption property to whatever i needed it to be for each day.

Well point is, on click of one of these labels I need some code to run to capture the Name or Caption of the label I just clicked on? Make Sense?

Well, with a text box I can say Me.ActiveControl.Name and retrieve the Name of the textbox... With a label I Cannot. Is there anyway to retrieve the caption or the name of a label on click?

Hope that makes sense

Thanks guys
 
Since a Label cannot be Active you will need to reference the controls in the OnClick event


Example
Code:
Private Sub MyLabel_Click()
   Dim MyObject as Object

   Set MyObject=Me.[[COLOR=royalblue]MyLabel[/COLOR] ]
   Debug.Print myObject.Name
   Debug.Print myObject.Caption
End Sub

This is because you will know what has been clicked by the Click Event fired.
 

Users who are viewing this thread

Back
Top Bottom