I have a tabControl on frmForm. When the user selects a particular tab (e.g.
Tab2) I would like to run a procedure. I can activate a procedure when the
user clicks on the tab control using: private sub TabControl_Change(). But
how do I evaluate which tab was selected (for example)
private sub TabControl_Change()
if me.TabControl = "Tab2" Then
Beep
End if
End Sub
I tried this but it doesn't work. Any help would be appreciated. Thanks.
Douglas J. Steele - 11 Feb 2006 15:35 GMT
What you're calling "Tab2" is actually the name of a Page object in the Tab
control's Pages collection.
The Tab control's Value property tells you what page is current.
What you likely want, then, is:

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
>I have a tabControl on frmForm. When the user selects a particular tab
>(e.g.
[quoted text clipped - 7 lines]
> End Sub
> I tried this but it doesn't work. Any help would be appreciated. Thanks.
Douglas J. Steele - 11 Feb 2006 15:36 GMT
Sorry about that: hit Enter too soon!
What you're calling "Tab2" is actually the name of a Page object in the Tab
control's Pages collection.
The Tab control's Value property tells you what page is current.
What you likely want, then, is:
If Me.TabControl.Pages(Me.TabControl.Value).Name = "Tab2" Then

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
>I have a tabControl on frmForm. When the user selects a particular tab
>(e.g.
[quoted text clipped - 7 lines]
> End Sub
> I tried this but it doesn't work. Any help would be appreciated. Thanks.