Question : How can I trigger the event On click of a page in a tab control?

Hi:

Private Sub Mechanical_Click()
   MsgBox " here you click the page (Mechaical) of a tab control (tbControl) "
End Sub
" Mechanical" is a page at "tbControl" tab control
I put this message at the event on click of the page
But nothing happen?
please

Answer : How can I trigger the event On click of a page in a tab control?

Try this, replacing the illustrative object names with the names used in your application:

Private Sub TabCtl1_Change()
On Error GoTo Error_Routine

'commits any changes
If Me.Dirty Then Me.Dirty = False
Select Case Me.TabCtl1.Value
    Case Is = 0   'run code for page1...(Me.Page1.PageIndex = 0)
        .............................................
        TabCtl1.Pages.Item(0).SetFocus
    Case Is = 1   'run code for page2......(Me.Page2.PageIndex = 1)
        .............................................
        TabCtl1.Pages.Item(1).SetFocus
    Case Is = 2   'run code for page3.....(Me.Page3.PageIndex = 2)
        .............................................
        TabCtl1.Pages.Item(2).SetFocus
    Case Is = 3   'run code for page4.....(Me.Page4.PageIndex = 3)
        If Not IsNull([yourField]) then
           Me!Subform4.Visible = False
        Else
           Me!Subform4.Visible = True
        End If
        TabCtl1.Pages.Item(3).SetFocus
End Select
Exit_Continue:
        Exit Sub
Error_Routine:
        MsgBox "Error# " & Err.Number & " " & Err.Description
        Resume Exit_Continue

End Sub

   
Random Solutions  
 
programming4us programming4us