Steve Schapel
miscellany at mvps.org
Mon Jun 11 16:09:29 CDT 2007
Arthur,
I have used Stephen Lebans's approach, and it is quite effective.
However, I often find it easier to handle the situation like this...
1. Make a rectangle control, the same size as the tab control. Set its
BackColor to (in your case) white.
2. Overlay it behind the tab control (Format=>Send To Back).
3. Set the Back Style property of the tab control to Transparent.
4. Set the Style property of the tab control to None.
5. Make an Option Group, and add to it a Toggle Button for each page of
the tab control.
6. Format the option group buttons to look similar to the tab buttons,
if you like, and place them where the tabs would have been if you hadn't
hidden them via the Style property.
7. Put code behind the option group, something like this...
Public Sub MyOptionGroup_AfterUpdate()
Select Case Me.MyOptionGroup
Case 1
Me.FirstTabPage.SetFocus
Case 2
Me.SecondTabPage.SetFocus
End Select
End Sub
Obviously not exactly like a tab control operated by tabs, but it allows
for coloured background, and handles the grey tab strip problem. I
think it works well.
I also use the same code to load the data into any subforms on different
tab pages, so the data is only accessed if needed. For example, to
expand on the above...
Public Sub MyOptionGroup_AfterUpdate()
Select Case Me.MyOptionGroup
Case 1
Me.FirstTabPage.SetFocus
Case 2
If Me.SubformOn2ndPage.Form.RecordSource = "" Then
Me.SubformOn2ndPage.Form.RecordSource = "MyQuery"
End If
Me.SecondTabPage.SetFocus
End Select
End Sub
Regards
Steve
Arthur Fuller wrote:
> One is never "stuck with" any of Lebans's offerings. The man is brilliant!
>