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