referenceing tab control tabs(pages)

J

John

I have a tab control on a form which when a user clicks on the General
tab certain events need to occur under certain conditions. I was
testing out the following and it was not showing the msgbox.

Dim page_select As String
page_select = .Pages(.Value).Name

With Me(TabCtl30)
If page_select = "pageGeneral" Then
MsgBox "you are at pageGeneral"
End If

End With

How is the tab referred to?

Thanks...John
 
M

Marshall Barton

John said:
I have a tab control on a form which when a user clicks on the General
tab certain events need to occur under certain conditions. I was
testing out the following and it was not showing the msgbox.

Dim page_select As String
page_select = .Pages(.Value).Name

With Me(TabCtl30)
If page_select = "pageGeneral" Then
MsgBox "you are at pageGeneral"
End If

End With

How is the tab referred to?


You are referring to the tab control correctly. Maybe you
are comparing to the page's Caption or maybe the page's Name
is not "pageGeneral". If you got an error, it's probably
because the first line is outside the With block.


Dim page_select As String
With Me(TabCtl30)
page_select = .Pages(.Value).Name
If page_select = "pageGeneral" Then
MsgBox "you are at pageGeneral"
End If

End With
 
Top