A
alex
Hide Controls on Subform
Using Access ’03…
I can’t seem to hide any controls on my subform:
Private Sub Form_Load()
'Dim sfrm As SubForm
'hide unnecessary controls
Dim ctl As Control
Dim ctlName As String
For Each ctl In Me.sfrmMessage.Form.Controls
ctlName = ctl.Name
Select Case ctl.Tag
Case "sfrm" 'should be accessible on subform
ctl.Visible = True
Debug.Print ctlName
Case Else
ctl.Visible = False
End Select
Next ctl
End Sub
No matter where I set the focus on the main Form, I still get the
error saying: cannot hide a control that has the focus! My subform
opens in datasheet view.
Any thoughts?
Thanks,
alex
Using Access ’03…
I can’t seem to hide any controls on my subform:
Private Sub Form_Load()
'Dim sfrm As SubForm
'hide unnecessary controls
Dim ctl As Control
Dim ctlName As String
For Each ctl In Me.sfrmMessage.Form.Controls
ctlName = ctl.Name
Select Case ctl.Tag
Case "sfrm" 'should be accessible on subform
ctl.Visible = True
Debug.Print ctlName
Case Else
ctl.Visible = False
End Select
Next ctl
End Sub
No matter where I set the focus on the main Form, I still get the
error saying: cannot hide a control that has the focus! My subform
opens in datasheet view.
Any thoughts?
Thanks,
alex