Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the label of a control in code

Tags:

vba

ms-access

Often a label control is bound to a textbox or similar other control. I know that there is a way to access the label through code, but I do not remember how to do it.

Can anyone help?

Maybe something like:

Me.txtName.Child!lblName.Value

Or

Me.txtName.Parent!lblName.Value

I will use this when I am enumerating through the controls on a form for validation purposes. Then I want to use the label for a control as information in the error message to show the user where the error is.

like image 395
Markus Avatar asked Oct 28 '09 12:10

Markus


People also ask

What is the label in access?

A label can be attached to another control. When you create a text box, for example, it has an attached label that displays a caption for that text box.

What is controlled label?

Control Label and Private Label A Control Label is one where the alcohol brand is owned and controlled by the supplier but is dedicated to one specific retail account. In this case, the product is manufactured according to the specifications of the retailer.


1 Answers

With the textbox you can try

Text0.Controls.Item(0).Caption

where Control 0 is the linked label

like image 94
Adriaan Stander Avatar answered Sep 18 '22 13:09

Adriaan Stander