Hi all How can I make a statement if label have text And TextBox have no text in a loop? I can't find anything about it I know with a textbox I can use the .TextLength but that don't work as .CaptionLength Hope you can help
For k = 2 To 41
If Me.Controls("Label" & k).CaptionLength < 0 And Me.Controls("TextBox" &
k).TextLength = 0 Then
MsgBox "You have a name without Hdc"
Exit Sub
End If
UPDATED With working Code
Dim k As Long
For k = 1 To 40
If Len(Me.Controls("Label" & k).Caption) > 0 And Me.Controls("TextBox" &
k).Text = vbNullString Then
MsgBox "You have a name without Hdc"
Exit Sub
End If
Next