Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox label

Status
Not open for further replies.

dmaytum

Programmer
Joined
Mar 4, 2003
Messages
23
Location
US
Is there any way to access the checkbox label in VB. Something like Me!cbx1.Label = "choice 1
 
dmaytum
I'm not sure when you want to make the change, but here is an example...

Say you have a text box called txtMyText and a check box called chkMyCheck that has a label called lblMyCheck. On the AfterUpdate event you could change the caption for the label attached to chkMyCheck.

Code:
If Me.txtMyText = [COLOR=blue] whatever value[/color] Then
Me.lblMyCheck.Caption = [COLOR=red] whatever you want[/color]
Else
Me.lblMyCheck.Caption = [COLOR=red]some other value[/color]
End If

Hope that helps.

Tom
 
Do you mean you wish to find the name of the label associated with the control?

Code:
'If the label does not exist, you will get an error.
On Error Resume Next
Dim frm As Form
Set frm = Forms!frmForm
strCaption=frm(frm.Check0.Controls(0).Name).Caption

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top