T
Tracey
I have a main form with 5 tab controls each containing a subform. On my main
form I have a checkbox called HDHP. If checked, only one of the 5 tab
controls should display. If unchecked, the remaining 4 tab controls should
display and the 5th tab control should be invisible. My code results in the
error "can't hide control that has the focus". I have the code on "On
Current" for the form and on the "AfterUpdate" for the checkbox. Using Access
2003.
Private Sub Form_Current()
TogglePage
End Sub
Private Sub TogglePage()
If Me.HDHP_Check = True Then
Me.TabCtl56.Pages(0).Visible = False
Me.TabCtl56.Pages(1).Visible = False
Me.TabCtl56.Pages(2).Visible = False
Me.TabCtl56.Pages(3).Visible = False
Me.TabCtl56.Pages(4).Visible = True
Else
Me.TabCtl56.Pages(0).Visible = True
Me.TabCtl56.Pages(1).Visible = True
Me.TabCtl56.Pages(2).Visible = True
Me.TabCtl56.Pages(3).Visible = True
Me.TabCtl56.Pages(4).Visible = False
End If
End Sub
How do I correct this error? Thanks.
form I have a checkbox called HDHP. If checked, only one of the 5 tab
controls should display. If unchecked, the remaining 4 tab controls should
display and the 5th tab control should be invisible. My code results in the
error "can't hide control that has the focus". I have the code on "On
Current" for the form and on the "AfterUpdate" for the checkbox. Using Access
2003.
Private Sub Form_Current()
TogglePage
End Sub
Private Sub TogglePage()
If Me.HDHP_Check = True Then
Me.TabCtl56.Pages(0).Visible = False
Me.TabCtl56.Pages(1).Visible = False
Me.TabCtl56.Pages(2).Visible = False
Me.TabCtl56.Pages(3).Visible = False
Me.TabCtl56.Pages(4).Visible = True
Else
Me.TabCtl56.Pages(0).Visible = True
Me.TabCtl56.Pages(1).Visible = True
Me.TabCtl56.Pages(2).Visible = True
Me.TabCtl56.Pages(3).Visible = True
Me.TabCtl56.Pages(4).Visible = False
End If
End Sub
How do I correct this error? Thanks.