Full Version: Which page is active on a tab control?
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
vincent1701
I'm sure there is a way to do this...

I would like to enable/disable buttons and such depending on which page of a tab control is being shown.

Is there an event of the tab control that I can put some code into to accomplish this when the page selected changes? Also how I can determine which page is currently active?

any help would be appreciated.

Vince
LPurvis
You can use the tab control's Change event to determine if the page has changed.
As for which page - each page has an ordinal position assigned by the Page Index property.
You can determine this by the tab control's Value property.

e.g.
CODE
Private Sub TabControl_Change()

        

    If Me.TabControl.Value = 0 Then

        'We're on the first page

    Else

        'etc

    End If

    

End Sub


If you want to make it a little more user friendly you can determine the name or title of the currently selected page with code like

CODE
Me.TabControl.Pages(Me.TabControl.Value).Name

'or

Me.TabControl.Pages(Me.TabControl.Value).Caption
vincent1701
Thank you Leigh. I appreciate it!
LPurvis
No problemo.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.