dbTalk Databases Forums  

capture control's label text

comp.databases.ms-access comp.databases.ms-access


Discuss capture control's label text in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bobh
 
Posts: n/a

Default capture control's label text - 07-06-2011 , 08:16 AM






Hi All,

I'm trying to capture the text of the control's label in a function
that I would place on the code sheet of the form and don't know the
coding needed, this does not work but hoped it shows what I'm trying
to do.

If Me.ActiveControl = False Then
Me.bxExplanation = Me.ActiveControl.Label.Caption & " - "
End If

anybody know how to capture the text of the active control's label and
add it to another control on the form?
thanks
bobh.

Reply With Quote
  #2  
Old   
Access Developer
 
Posts: n/a

Default Re: capture control's label text - 07-06-2011 , 10:51 AM






Where are you putting the code, and what do you expect to cause it to
execute? That is, you want it to run in response to what event?

The "Me" shorthand does not refer to a Control and the "ActiveControl"
property is not a "True/False" value. So perhaps you would explain your
intent for the statement "If Me.ActiveControl = False Then"?

Here's a reference about capturing the label associated with a Control:

http://www.pcreview.co.uk/forums/ref...-t3740551.html

However, just by the way, not all Controls have an "associated" label. Some
developers, for their own convenience, separate a by-default-associated
Label, so they can more easily move the Label and the Control individually
in Design View. Also, a Label Control can be placed on the Form directly,
and will not be associated with any other control.

And, perhaps if you would explain what you are trying to accomplish, not how
you wanted to accomplish it, someone could be of more assistance.

--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access


"bobh" <vulcaned (AT) yahoo (DOT) com> wrote

Quote:
Hi All,

I'm trying to capture the text of the control's label in a function
that I would place on the code sheet of the form and don't know the
coding needed, this does not work but hoped it shows what I'm trying
to do.

If Me.ActiveControl = False Then
Me.bxExplanation = Me.ActiveControl.Label.Caption & " - "
End If

anybody know how to capture the text of the active control's label and
add it to another control on the form?
thanks
bobh.

Reply With Quote
  #3  
Old   
bobh
 
Posts: n/a

Default Re: capture control's label text - 07-06-2011 , 03:05 PM



On Jul 6, 11:51*am, "Access Developer" <accde... (AT) gmail (DOT) com> wrote:
Quote:
Where are you putting the code, and what do you expect to cause it to
execute? *That is, you want it to run in response to what event?

The "Me" shorthand does not refer to a Control and the "ActiveControl"
property is not a "True/False" value. So perhaps you would explain your
intent for the statement "If Me.ActiveControl = False Then"?

Here's a reference about capturing the label associated with a Control:

*http://www.pcreview.co.uk/forums/ref...ociated-label-....

However, just by the way, not all Controls have an "associated" label. *Some
developers, for their own convenience, separate a by-default-associated
Label, so they can more easily move the Label and the Control individually
in Design View. *Also, a Label Control can be placed on the Form directly,
and will not be associated with any other control.

And, perhaps if you would explain what you are trying to accomplish, not how
you wanted to accomplish it, someone could be of more assistance.

*--
*Larry Linson, Microsoft Office Access MVP
*Co-author: "Microsoft Access Small Business Solutions", published by Wiley
*Access newsgroup support is alive and well in USENET
comp.databases.ms-access

"bobh" <vulca... (AT) yahoo (DOT) com> wrote in message

news:517f81d8-f9c9-4f36-838d-0cd28fe6be1b (AT) d14g2000yqb (DOT) googlegroups.com...



Hi All,

I'm trying to capture the text of the control's label in a function
that I would place on the code sheet of the form and don't know the
coding needed, this does not work but hoped it shows what I'm trying
to do.

* If Me.ActiveControl = False Then
* * *Me.bxExplanation = Me.ActiveControl.Label.Caption & " - "
* End If

anybody know how to capture the text of the active control's label and
add it to another control on the form?
thanks
bobh.- Hide quoted text -

- Show quoted text -
ok I'll try to explain better,
I have a form which has many checkbox controls on it, all of them have
it's associated label which has meaningful text in them. When a user
checks any checkbox I want the text of the associated label to be
added to another textbox control on the same form.
So that I would not have to write the vba code in the 'on click' event
of each checkbox I was looking for more generic vba coding whereby on
each checkboxs click event I could just do a call to a function and
pass the name of the checkbox control that I just clicked on(active
control) and then in that function get that controls associated label
text and append it to the textbox that is on that same form.
bobh.

Reply With Quote
  #4  
Old   
agiamb
 
Posts: n/a

Default Re: capture control's label text - 07-06-2011 , 05:34 PM



Screen.ActiveControl.Controls(0).Caption

--

AG
Email: npATadhdataDOTcom


"bobh" <vulcaned (AT) yahoo (DOT) com> wrote

On Jul 6, 11:51 am, "Access Developer" <accde... (AT) gmail (DOT) com> wrote:
Quote:
Where are you putting the code, and what do you expect to cause it to
execute? That is, you want it to run in response to what event?

The "Me" shorthand does not refer to a Control and the "ActiveControl"
property is not a "True/False" value. So perhaps you would explain your
intent for the statement "If Me.ActiveControl = False Then"?

Here's a reference about capturing the label associated with a Control:

http://www.pcreview.co.uk/forums/ref...ociated-label-...

However, just by the way, not all Controls have an "associated" label.
Some
developers, for their own convenience, separate a by-default-associated
Label, so they can more easily move the Label and the Control individually
in Design View. Also, a Label Control can be placed on the Form directly,
and will not be associated with any other control.

And, perhaps if you would explain what you are trying to accomplish, not
how
you wanted to accomplish it, someone could be of more assistance.

--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access

"bobh" <vulca... (AT) yahoo (DOT) com> wrote in message

news:517f81d8-f9c9-4f36-838d-0cd28fe6be1b (AT) d14g2000yqb (DOT) googlegroups.com...



Hi All,

I'm trying to capture the text of the control's label in a function
that I would place on the code sheet of the form and don't know the
coding needed, this does not work but hoped it shows what I'm trying
to do.

If Me.ActiveControl = False Then
Me.bxExplanation = Me.ActiveControl.Label.Caption & " - "
End If

anybody know how to capture the text of the active control's label and
add it to another control on the form?
thanks
bobh.- Hide quoted text -

- Show quoted text -
ok I'll try to explain better,
I have a form which has many checkbox controls on it, all of them have
it's associated label which has meaningful text in them. When a user
checks any checkbox I want the text of the associated label to be
added to another textbox control on the same form.
So that I would not have to write the vba code in the 'on click' event
of each checkbox I was looking for more generic vba coding whereby on
each checkboxs click event I could just do a call to a function and
pass the name of the checkbox control that I just clicked on(active
control) and then in that function get that controls associated label
text and append it to the textbox that is on that same form.
bobh.

Reply With Quote
  #5  
Old   
bobh
 
Posts: n/a

Default Re: capture control's label text - 07-08-2011 , 02:44 PM



On Jul 6, 6:34*pm, "agiamb" <NOSPAMagi... (AT) newsgroup (DOT) nospam> wrote:
Quote:
Screen.ActiveControl.Controls(0).Caption

--

AG
Email: npATadhdataDOTcom

"bobh" <vulca... (AT) yahoo (DOT) com> wrote in message

news:ad88dac7-7098-4af9-a30d-5b0fda160350 (AT) b2g2000vbo (DOT) googlegroups.com...
On Jul 6, 11:51 am, "Access Developer" <accde... (AT) gmail (DOT) com> wrote:





Where are you putting the code, and what do you expect to cause it to
execute? That is, you want it to run in response to what event?

The "Me" shorthand does not refer to a Control and the "ActiveControl"
property is not a "True/False" value. So perhaps you would explain your
intent for the statement "If Me.ActiveControl = False Then"?

Here's a reference about capturing the label associated with a Control:

http://www.pcreview.co.uk/forums/ref...ociated-label-...

However, just by the way, not all Controls have an "associated" label.
Some
developers, for their own convenience, separate a by-default-associated
Label, so they can more easily move the Label and the Control individually
in Design View. Also, a Label Control can be placed on the Form directly,
and will not be associated with any other control.

And, perhaps if you would explain what you are trying to accomplish, not
how
you wanted to accomplish it, someone could be of more assistance.

--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access

"bobh" <vulca... (AT) yahoo (DOT) com> wrote in message

news:517f81d8-f9c9-4f36-838d-0cd28fe6be1b (AT) d14g2000yqb (DOT) googlegroups.com....

Hi All,

I'm trying to capture the text of the control's label in a function
that I would place on the code sheet of the form and don't know the
coding needed, this does not work but hoped it shows what I'm trying
to do.

If Me.ActiveControl = False Then
Me.bxExplanation = Me.ActiveControl.Label.Caption & " - "
End If

anybody know how to capture the text of the active control's label and
add it to another control on the form?
thanks
bobh.- Hide quoted text -

- Show quoted text -

ok I'll try to explain better,
I have a form which has many checkbox controls on it, all of them have
it's associated label which has meaningful text in them. When a user
checks any checkbox I want the text of the associated label to be
added to another textbox control on the same form.
So that I would not have to write the vba code in the 'on click' event
of each checkbox I was looking for more generic vba coding whereby on
each checkboxs click event I could just do a call to a function and
pass the name of the checkbox control that I just clicked on(active
control) and then in that function get that controls associated label
text and append it to the textbox that is on that same form.
bobh.- Hide quoted text -

- Show quoted text -
perfect!!! worked great, Thanks

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.