Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    220

    Unanswered: Help with tabs on form

    I have a form called frm_Main. On this form, there are 3 other tabs (Categ1, Categ2, Categ3). Also on Main is a option group where users choose Opt1, Opt2, or Opt3.

    When they click the OK button, based on which option the user chose, I want to go to the appropriate tabbed page. That is, if they choose Opt1, goto page Categ1, and so on.

    How on earth do I reference and jump to each page based on the option group?

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You simply refer to the tabbed pages like any other control and set focus to them. On the On_Click sub for the frame of your option group you can use Select Case to decide which tabbed page to got to. Assumming your frame is named MyOptionGroupFrame (change it to the actual name of your frame):

    Private Sub MyOptionGroupFrame_Click()

    Select Case MyOptionGroupFrame

    Case Is = 1
    Categ1.SetFocus

    Case Is = 2
    Categ2.SetFocus

    Case Is = 3
    Categ3.SetFocus

    End Select

    End Sub

    When you click on, say the second button in the group, the focus will go to the second tab, or Categ2!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Sep 2005
    Posts
    220
    That's great. Thanks. What I need it to do however is to trigger when the user clicks OK. Right now, it switches to the corresponding tab as soon as they choose one of the options.

    I've tried tying it to the clickOK event but it still fires off as soon as they choose the option.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Okay, ssmith001, first delete the sub MyOptionGroupFrame _Click()

    Then behind your command button's Click property put the same code, simply replacing the name YourCommandButtonName with your own button name:

    Private Sub YourCommandButtonName_Click()

    Select Case MyOptionGroupFrame

    Case Is = 1
    Categ1.SetFocus

    Case Is = 2
    Categ2.SetFocus

    Case Is = 3
    Categ3.SetFocus

    End Select

    End Sub

    Now Access will wait until your user clicks on the command button to change tabbed pages.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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