Connecting Tech Pros Worldwide Help | Site Map

Control Label

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 05:18 PM
Mark
Guest
 
Posts: n/a
Default 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



  #2  
Old November 12th, 2005, 05:18 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Control Label

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" <mmorrow@earthlink.net> wrote in message
news:JetHb.3479$d4.2546@newsread1.news.atl.earthli nk.net...[color=blue]
> How do you reference the caption of the label attached to a control on a[/color]
form by[color=blue]
> 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[/color]


  #3  
Old November 12th, 2005, 05:19 PM
Mark
Guest
 
Posts: n/a
Default Re: Control Label

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" <AllenBrowne@SeeSig.Invalid> wrote in message
news:3fee6508$0$1747$5a62ac22@freenews.iinet.net.a u...[color=blue]
> 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" <mmorrow@earthlink.net> wrote in message
> news:JetHb.3479$d4.2546@newsread1.news.atl.earthli nk.net...[color=green]
> > How do you reference the caption of the label attached to a control on a[/color]
> form by[color=green]
> > 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[/color]
>
>[/color]


  #4  
Old November 12th, 2005, 05:19 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Control Label

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" <mmorrow@earthlink.net> wrote in message
news:UMKHb.13137$IM3.484@newsread3.news.atl.earthl ink.net...[color=blue]
> 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" <AllenBrowne@SeeSig.Invalid> wrote in message
> news:3fee6508$0$1747$5a62ac22@freenews.iinet.net.a u...[color=green]
> > 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" <mmorrow@earthlink.net> wrote in message
> > news:JetHb.3479$d4.2546@newsread1.news.atl.earthli nk.net...[color=darkred]
> > > How do you reference the caption of the label attached to a control on[/color][/color][/color]
a[color=blue][color=green]
> > form by[color=darkred]
> > > first referencing the form?
> > >
> > > For example, textbox named Addr1 has an attached label with the[/color][/color][/color]
caption[color=blue][color=green][color=darkred]
> > > "Address1". What is the expression to get a Msgbox to display[/color][/color][/color]
"Address1" ?[color=blue][color=green][color=darkred]
> > >
> > > Something like:
> > >
> > > MsgBox Me!Addr1.AttachedLabel.Caption[/color][/color][/color]


  #5  
Old November 12th, 2005, 05:19 PM
Mark
Guest
 
Posts: n/a
Default Re: Control Label

Thanks, Allen! I appreciate the help.

Mark


"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:3fef7e03$0$1723$5a62ac22@freenews.iinet.net.a u...[color=blue]
> 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" <mmorrow@earthlink.net> wrote in message
> news:UMKHb.13137$IM3.484@newsread3.news.atl.earthl ink.net...[color=green]
> > 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" <AllenBrowne@SeeSig.Invalid> wrote in message
> > news:3fee6508$0$1747$5a62ac22@freenews.iinet.net.a u...[color=darkred]
> > > 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" <mmorrow@earthlink.net> wrote in message
> > > news:JetHb.3479$d4.2546@newsread1.news.atl.earthli nk.net...
> > > > How do you reference the caption of the label attached to a control on[/color][/color]
> a[color=green][color=darkred]
> > > form by
> > > > first referencing the form?
> > > >
> > > > For example, textbox named Addr1 has an attached label with the[/color][/color]
> caption[color=green][color=darkred]
> > > > "Address1". What is the expression to get a Msgbox to display[/color][/color]
> "Address1" ?[color=green][color=darkred]
> > > >
> > > > Something like:
> > > >
> > > > MsgBox Me!Addr1.AttachedLabel.Caption[/color][/color]
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.