Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Label Caption

Status
Not open for further replies.

MikeCDPQ

Technical User
Joined
Sep 11, 2003
Messages
173
Location
CA
I would like to know how I can get a label's caption by clicking on that label.

would be something like

screen.activecontrol but for labels

If I could only get that part I could take it from there to do other stuff.

Thanks
 
surely the caption is displayed in the label
If you go into the properties of the form and click on a caption you will what it is named.
ie caption_label
there are NO events on labels


Hope this helps
Hymn
 
Erm - attached labels have no events, but unattached labels (i e not attached to another control) has some events. But I don't think the Screen.ActiveControl works on a label. I think you'll need to address it by name (or index):

[tt]me("lblMyLabel").Caption[/tt]

Roy-Vidar
 
I apologise I think its time I packed in, my brain cell got stuck on a label of a textbox/control not just the label Goodnight one and all

Hope this helps
Hymn
 
Hey, happen to us all, no need to apologize;-)

Roy-Vidar
 
RoyVidar,

That is precisely the point. I don't want to have to refer to it by name. I have about 50 forms with more or less 15 fields each (continuous forms). I would like to be able to click on the label(indeed a detached label with events) and let's say have a msgbox "The label you just clicked on is " & label.caption

Retrieving the caption which is the corresponding control name will allow me to continue with my script.

I tried things with acLabel but nothing works.

Thanks for any suggestion.

Mike
 
You'll need to put some code into each event of each label (unless you're using a function directly in the event property of the label) - what is the difference of using:

[tt]msgbox "the label... " & me("lblMyLabel").caption ' and
msgbox "the label... " & screen.activethingiethatdoesntworkonlabels.caption[/tt]

To get the "functionality" of text controls on labels, convert them to unbound textcontrols, format them as you like... ;-)

Then on the textcontrols use:

[tt]msgbox "the label... " & screen.activecontrol.value[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top