![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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 - |
#4
| |||
| |||
|
|
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 - |
#5
| |||
| |||
|
|
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 - |

![]() |
| Thread Tools | |
| Display Modes | |
| |