Textbox label association

G

Gregory La Due

Is there any way to determine, programmatically, which label is associated
to a another control?

Gregory La Due
Twin Tiers Technologies, Inc.
 
D

Duane Hookom

A label control may be a child of a text box. For instance if your text box
is named txtFirstName, the associated labels caption might be

Forms!Employees!txtFirstName.Controls(0).caption
 
D

Douglas J. Steele

You can loop through all of the labels, and check what the parent is.

Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
If TypeOf ctlCurr Is Label Then
If ctlCurr.Parent.Name = "MyDesiredControl" Then
MsgBox "Label " & ctlCurr.Name & " is associated with
MyDesiredControl"
Exit For
End If
End If
Next ctlCurr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top