Newbie Tabs Question

  • Thread starter Thread starter Keith Wilby
  • Start date Start date
K

Keith Wilby

What event, if any, is fired by selecting a page on a tab control? I want
to use the same form on each page of the tab control but change its record
source depending on which page is selected.

Many thanks.
Keith.
 
You can use the Change event of the tab control, and examine the Value
property to determine which page is selected. The property is zero-based, so
Value is 0 when page 1 is selected, 1 when page 2 is selected, etc. Here's
an example ...

Private Sub TabCtl0_Change()

If Me.TabCtl0.Value = 0 Then
Me.Label3.Caption = "First Tab"
ElseIf Me.TabCtl0.Value = 1 Then
Me.Label3.Caption = "Second Tab"
Else
Me.Label3.Caption = "Some Other Tab"
End If

End Sub
 
Brendan Reynolds said:
You can use the Change event of the tab control, and examine the Value
property to determine which page is selected. The property is zero-based,
so Value is 0 when page 1 is selected, 1 when page 2 is selected, etc.
Here's an example ...

Private Sub TabCtl0_Change()

If Me.TabCtl0.Value = 0 Then
Me.Label3.Caption = "First Tab"
ElseIf Me.TabCtl0.Value = 1 Then
Me.Label3.Caption = "Second Tab"
Else
Me.Label3.Caption = "Some Other Tab"
End If

End Sub

Just the job, Brendan, many thanks indeed.

Regards,
Keith.
 
Back
Top