Help with Tab Control object

yhgtbfk

Registered User.
Local time
Today, 11:00
Joined
Aug 30, 2004
Messages
123
I want to run code when I change a page in the Tab Control object. The code I run depends on the page selected.

I tried the 'On Click' code of the page, but that didnt seem to run when I clicked on the pages.

The 'On Change' code of the Tab Control object seems to run whenever I change a page.

So the question is:

1/ Is it possible to run code when an individaul page is clicked on?

OR

2/ What is the syntax of identifying which page is selected?

If TabControl = 1 then

....

Else

...

????
 
The index is zero based:
Code:
Private Sub TabCtl2_Change()
On Error GoTo Err_TabCtl2_Change

Select Case Me.TabCtl2.Value

    Case 0
        '-- The 1st Tab
        '... Do Stuff
    Case 1
        '-- The 2nd Tab
        '... Do Other Stuff
    Case 2
        '-- The 3rd Tab
        '... Do Different Stuff

End Select

Exit_TabCtl2_Change:
    Exit Sub
    
Err_TabCtl2_Change:
    MsgBox "Error No:    " & Err.Number & vbCr & _
           "Description: " & Err.Description
    Resume Exit_TabCtl2_Change

End Sub
 
Thank you so much
 

Users who are viewing this thread

Back
Top Bottom