By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,583 Members | 3,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,583 IT Pros & Developers. It's quick & easy.

Control Label

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.