0
votes

I need to attach a label to a textbox and I'd like to know where in the property sheet I can do it or how to do it.

thanks in advance.

19-Mar-2015 (8:45 am) at Rio de Janeiro

I'd like to share this code for manipulation of parent/child controls:

Private Sub Comando15_Click()
On Error GoTo Err_Handler
Dim ctl As Control

For Each ctl In Me.Form.Controls
    With ctl
        If .ControlType = acLabel Then
            If .Parent.Name <> Me.Form.Name Then
                MsgBox "Controle Pai: " & Chr(13) + Chr(10) & .Parent.Name & Chr(13) + Chr(10) + Chr(10) & _
                    "Controle Filho: " & Chr(13) + Chr(10) & .Name
            End If
        End If
    End With
Next ctl

Exit_Handler: Exit Sub Err_Handler: MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number Resume Exit_Handler End Sub

1
Are you creating the textbox in Form Design or through some VBA code? If it's in code, can you add that to your question and tell us what's not working? - Mark Wickett
I'm creating it in the form design. do you know which field in the property sheet is used to define a label as child of a textbox, for instance? thanks. - Thor My

1 Answers

0
votes

wow! I found it! in order to attach a label to a textbox, open the form in the design view and select both label and textbox. a small warning box (with an exclamation and a dropdown button) will appear. just click on the button and select the option "attach lable_name to textbox_name". simple like that.

thanks Mark for your quick reply.