Hopefully this should be fairly easy, although after much searching I cant figure this out.
How do you find out if a control is located on a tab?
If ctl.ControlType <> 'Tab Controls' Then
.....
End if
The reason for doing this is that I have a piece of code that runs through the controls on a form, but runs into a problem when cycling through controls on a tab.
If ctl.Parent.CurrentView <> 2 Then
MsgBox ctl.Name
End If
The above causes the error:
Error: 348 Object doesnt suppor开发者_JS百科t this property or method
Obviously it appears you cant refer to the current view of a tab control
Cheers for any advice any one has got out there
Noel
Check what ctl
is before using CurrentView
:
Select Case ctl.ControlType
Case acCheckBox
' do something for check box
Case acTabCtl
' do something for tab control
End Select
精彩评论