Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tab Control OnClick Event (2002)

    I want to attach code to tabs on the tab control and can't get the onclick event to work when I click on a tab.
    Frank

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Tab Control OnClick Event (2002)

    For Tab Control you need to use control's On Change event not Click event. Sample code:

    <pre>Private Sub TabCtl0_Change()

    Select Case Me.TabCtl0
    Case 0 '1st tab
    MsgBox "First tab selected.", vbInformation, "TAB 1"
    Case 1 '2nd tab
    MsgBox "Second tab selected.", vbInformation, "TAB 2"
    End Select

    End Sub</pre>

    Note the Case 0 and Case 1 values refer to the Page Index property for each Page (tab) on Tab Control. The first tab index is 0, the second is 1, etc. To check index value, select Page in design view, Page Index is listed on Format tab of Property Sheet.

    HTH

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab Control OnClick Event (2002)

    Never thought I'd have to do this.
    You click on the tab and it says on click.
    Thought you could use that.
    Oh Well.
    And much thanks.
    Frank <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •