D
DavidK
I have a Tab Control that I want to load secondary forms (which have their
own Tab Controls). I'm close, but still having difficulty correctly setting
focus on the secondary forms.
frmDASHBOARD has TabCtl0 with 7 tabs/pages (0-6)
onChange page(1) I load frmAUTO which has TabCtl1 also (coincidentally) with
7 tabs/pages (0-6)
onChange page(2) I load frmCONSOLIDATION which has TabCtl2 with 7 tabs/pages
(0-6)
onChange page(3) I load frmFLOORPICK which has TabCtl3 with... etc, etc.
onChange page(4)...
onChange page(5)...
onChange page(6)...
The onChange event on frmMAIN correctly identifies the secondary form to
load but I cannot get the focus set on the secondary forms. I can get the
onChange event on the secondary forms to set focus on any page I want on
frmMAIN (even though it should always return to page(0)). But my VB code
doesn't seem to recognize TabCtl1 - TabCtl6
Here is my main form onChange code:
Private Sub TabCtl0_Change()
' When click on one of the Dept tabs, open Dept form on 2nd tab
If Me.TabCtl0.Value = 1 Then
DoCmd.OpenForm "AUTO"
TabCtl1.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 2 Then
DoCmd.OpenForm "CONSOLIDATION"
TabCtl2.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 3 Then
DoCmd.OpenForm "FLOOR PICK"
TabCtl3.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 4 Then
DoCmd.OpenForm "MANUAL"
TabCtl4.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 5 Then
DoCmd.OpenForm "PALLET MOD"
TabCtl5.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 6 Then
DoCmd.OpenForm "SHIPPING"
TabCtl6.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 7 Then
DoCmd.OpenForm "IRG"
TabCtl7.Pages(1).SetFocus
End If
End Sub
On the return, my code works fine:
Private Sub TabCtl1_Change()
' When click on Home tab, open DASHBOARD form on 1st tab
If Me.TabCtl1.Value = 0 Then
DoCmd.OpenForm "DASHBOARD"
TabCtl0.Pages(0).SetFocus
End If
End Sub
Any help would be appreciated - I'm going nuts with this!
own Tab Controls). I'm close, but still having difficulty correctly setting
focus on the secondary forms.
frmDASHBOARD has TabCtl0 with 7 tabs/pages (0-6)
onChange page(1) I load frmAUTO which has TabCtl1 also (coincidentally) with
7 tabs/pages (0-6)
onChange page(2) I load frmCONSOLIDATION which has TabCtl2 with 7 tabs/pages
(0-6)
onChange page(3) I load frmFLOORPICK which has TabCtl3 with... etc, etc.
onChange page(4)...
onChange page(5)...
onChange page(6)...
The onChange event on frmMAIN correctly identifies the secondary form to
load but I cannot get the focus set on the secondary forms. I can get the
onChange event on the secondary forms to set focus on any page I want on
frmMAIN (even though it should always return to page(0)). But my VB code
doesn't seem to recognize TabCtl1 - TabCtl6
Here is my main form onChange code:
Private Sub TabCtl0_Change()
' When click on one of the Dept tabs, open Dept form on 2nd tab
If Me.TabCtl0.Value = 1 Then
DoCmd.OpenForm "AUTO"
TabCtl1.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 2 Then
DoCmd.OpenForm "CONSOLIDATION"
TabCtl2.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 3 Then
DoCmd.OpenForm "FLOOR PICK"
TabCtl3.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 4 Then
DoCmd.OpenForm "MANUAL"
TabCtl4.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 5 Then
DoCmd.OpenForm "PALLET MOD"
TabCtl5.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 6 Then
DoCmd.OpenForm "SHIPPING"
TabCtl6.Pages(1).SetFocus
ElseIf Me.TabCtl0.Value = 7 Then
DoCmd.OpenForm "IRG"
TabCtl7.Pages(1).SetFocus
End If
End Sub
On the return, my code works fine:
Private Sub TabCtl1_Change()
' When click on Home tab, open DASHBOARD form on 1st tab
If Me.TabCtl1.Value = 0 Then
DoCmd.OpenForm "DASHBOARD"
TabCtl0.Pages(0).SetFocus
End If
End Sub
Any help would be appreciated - I'm going nuts with this!