开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜