473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Control Label

How do you reference the caption of the label attached to a control on a form by
first referencing the form?

For example, textbox named Addr1 has an attached label with the caption
"Address1". What is the expression to get a Msgbox to display "Address1" ?

Something like:

MsgBox Me!Addr1.AttachedLabel.Caption

Thanks!

Mark
Nov 12 '05 #1
4 2833
The attached label is the first member of the Controls collection:

MsgBox Me!Addr1.Controls(0).Caption

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:Je****************@newsread1.news.atl.earthli nk.net...
How do you reference the caption of the label attached to a control on a form by first referencing the form?

For example, textbox named Addr1 has an attached label with the caption
"Address1". What is the expression to get a Msgbox to display "Address1" ?

Something like:

MsgBox Me!Addr1.AttachedLabel.Caption

Nov 12 '05 #2
Allen,

Thank you very much!!

What else is in the controls collection of a control? Can you point me to
something in Help on this?

Mark
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
The attached label is the first member of the Controls collection:

MsgBox Me!Addr1.Controls(0).Caption

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:Je****************@newsread1.news.atl.earthli nk.net...
How do you reference the caption of the label attached to a control on a

form by
first referencing the form?

For example, textbox named Addr1 has an attached label with the caption
"Address1". What is the expression to get a Msgbox to display "Address1" ?

Something like:

MsgBox Me!Addr1.AttachedLabel.Caption


Nov 12 '05 #3
Hi Mark. This collection is kind of an oddity for text boxes, as they can't
have anything but an attached label. It's probably there in help somewhere,
but you have to stumble across it - usually by asking questions in the
newsgroups. :-)

The option buttons in an option group are part of its Controls collection.

Tab control pages have a Controls collection - and each control has a
TabIndex within that collection.

Forms and reports have lots of members in their Controls collection, and
their sections (e.g. Detail) also have a Controls collection.

To go the opposite direction, ask for the Parent of the control.

If you are ever working in Access 1 or 2, things don't work like that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:UM*****************@newsread3.news.atl.earthl ink.net...
Allen,

Thank you very much!!

What else is in the controls collection of a control? Can you point me to
something in Help on this?

Mark
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
The attached label is the first member of the Controls collection:

MsgBox Me!Addr1.Controls(0).Caption

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:Je****************@newsread1.news.atl.earthli nk.net...
How do you reference the caption of the label attached to a control on a
form by
first referencing the form?

For example, textbox named Addr1 has an attached label with the

caption "Address1". What is the expression to get a Msgbox to display "Address1" ?
Something like:

MsgBox Me!Addr1.AttachedLabel.Caption

Nov 12 '05 #4
Thanks, Allen! I appreciate the help.

Mark
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
Hi Mark. This collection is kind of an oddity for text boxes, as they can't
have anything but an attached label. It's probably there in help somewhere,
but you have to stumble across it - usually by asking questions in the
newsgroups. :-)

The option buttons in an option group are part of its Controls collection.

Tab control pages have a Controls collection - and each control has a
TabIndex within that collection.

Forms and reports have lots of members in their Controls collection, and
their sections (e.g. Detail) also have a Controls collection.

To go the opposite direction, ask for the Parent of the control.

If you are ever working in Access 1 or 2, things don't work like that.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:UM*****************@newsread3.news.atl.earthl ink.net...
Allen,

Thank you very much!!

What else is in the controls collection of a control? Can you point me to
something in Help on this?

Mark
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
The attached label is the first member of the Controls collection:

MsgBox Me!Addr1.Controls(0).Caption

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <mm*****@earthlink.net> wrote in message
news:Je****************@newsread1.news.atl.earthli nk.net...
> How do you reference the caption of the label attached to a control on a form by
> first referencing the form?
>
> For example, textbox named Addr1 has an attached label with the caption > "Address1". What is the expression to get a Msgbox to display "Address1" ? >
> Something like:
>
> MsgBox Me!Addr1.AttachedLabel.Caption


Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a...
1
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
0
by: nate | last post by:
the error returned is this: Server Error in '/AnnAccRpt' Application. -------------------------------------------------------------------------------- Could not find control 'DropDownList1' in...
1
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. ...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
8
by: Arpan | last post by:
Consider the following code snippet (my main intention is to display the current time in a Label control as & when this ASPX page is accessed/refreshed): <script runat="server"> Class Clock...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.