Navigating a Tab Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus

    #1

    Navigating a Tab Control


    I have a tab control with 3 pages. I am on page 2 of the Tab
    Control, and I am trying to set the focus to the 1st combo box on
    that page.

    I have this so far:

    Me.cboMOI2.SetF ocus

    but, instead it sets the focus to cboMOI1 which is on page 1 of the
    Tab Control.

    I also tried

    Me.pgStartDate. cboMOI2.SetFocu s

    but that didn't work either.

    Any ideas on how to solve this issue?


    Marcus
    ******

  • pietlinden@hotmail.com

    #2
    Re: Navigating a Tab Control

    these both worked... between the two, you should be able to sort it
    out.

    Private Sub Command19_Click ()
    '--just returns some inane thing like
    ' cboName=Dog
    '--in a message box

    Dim strMsg As String
    strMsg = Me.TabCtl0.Page s(2).Controls(0 ).Name & "=" &
    Me.TabCtl0.Page s(2).Controls(0 ).Value
    MsgBox strMsg
    End Sub

    Private Sub Command20_Click ()
    Me.TabCtl0.Page s(2).Controls(0 ).SetFocus
    End Sub

    so you should be able to use
    Me.TabCtl0.Page s(2).Controls(" ControlName").S etFocus

    just as well. Just modify to suit your needs.

    One other fun thing - the tab controls don't act like real containers
    (like a subform does), so you can't have two controls on the same tab
    control but on different pages... (Was wondering why I couldn't
    specify a tab number of anything when I was in the QBE!)

    Comment

    Working...