Get the Caption of associated Label for a Form Control - Access 2007
As the title suggests, I'm trying to get the caption of the associated label for form controls eg:
Dim ctl As Control
Dim errMess As String
errMess = ""
For Each ctl In frm
With ctl
If (ctl.Tag = "*") Then
errMess = errMess & ctl.Caption & vbNewLine
End If
End If
End With
Next ctl
Obviou开发者_开发问答sly "ctl.Caption" doesn't work, I'm just not sure how to reference this.
Any help appreciated.
Cheers
Noel
Found out the answer is to use ctl.Controls.Item(0).Caption
Dim ctl As Control
Dim errMess As String
errMess = ""
For Each ctl In frm
With ctl
If (ctl.Tag = "*") Then
errMess = errMess & ctl.Controls.Item(0).Caption & vbNewLine
End If
End If
End With
Next ctl
精彩评论