I am trying to loop through all controls in a form and do something when a specific type of control is found. However, the control type is not a supported property. I did try to search the forum but without avail. I wrote the following codes which do not work. Hope someone can give me a hint.
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
Dim Crtl As Control
For Each Crtl In Me.Controls
If Crtl.type = "textbox" Then
MsgBox "Text box found."
Cancel = True
Exit Sub
End If
Next
Exit_Form_BeforeUpdate:
Exit Sub
Err_Form_BeforeUpdate:
MsgBox Err.Description, vbCritical
Resume Exit_Form_BeforeUpdate
End Sub
Thanks
Mike
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
Dim Crtl As Control
For Each Crtl In Me.Controls
If Crtl.type = "textbox" Then
MsgBox "Text box found."
Cancel = True
Exit Sub
End If
Next
Exit_Form_BeforeUpdate:
Exit Sub
Err_Form_BeforeUpdate:
MsgBox Err.Description, vbCritical
Resume Exit_Form_BeforeUpdate
End Sub
Thanks
Mike