how to dynamically change the tab that is showing based on criteria in the form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bberman
    New Member
    • Feb 2010
    • 2

    how to dynamically change the tab that is showing based on criteria in the form

    I have a form that has a control named Division that has 4 separate values and I want the tab control on the page to display the appropriate tab for the division that comes up. this is the code as I have written it:

    Private Sub Form_Current()
    Select Case Me.Division
    Case "Best Cheerleader"
    Me!TabCtl12.Val ue = 0
    Case "Best Dancer"
    Me!TabCtl12.Val ue = 1
    Case "Best Jumps"
    Me!TabCtl12.Val ue = 2
    Case "Best Tumbling Pass"
    Me!TabCtl12.Val ue = 3
    Case Else
    MsgBox "you idiot"
    End Select

    Yet to no end! all that happens is that the form gets a bit fuzzy and messed up. Please assist if you can
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Hi and welcome to Bytes

    What version of Access are you using?

    Please remember to use the [CODE][/CODE] tags aroud your code, as it makes it easier to read.

    I tried some simple code code, and it seemed to work fine. Maybe you have some other code running as well which messes it up.
    Code:
        If Me.ctrlTab.Value = 0 Then
            Me.ctrlTab.Value = 1
            Else
            Me.ctrlTab.Value = 0
        End If

    Comment

    • ClearRift
      New Member
      • Feb 2010
      • 5

      #3
      I had the same problem when trying to change the tab based on a result from the form. When i used .value it didn't work. So i tried the following with success:

      Code:
      Private Sub Form_Current()
      Select Case Me.Division
      Case "Best Cheerleader"
      Me.TabCtl12 = 0
      Case "Best Dancer"
      Me.TabCtl12 = 1
      Case "Best Jumps"
      Me.TabCtl12 = 2
      Case "Best Tumbling Pass"
      Me.TabCtl12 = 3
      Case Else
      MsgBox "you idiot"
      End Select

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        This may help, guys:

        Comment

        • bberman
          New Member
          • Feb 2010
          • 2

          #5
          thanks guys this helped...I went another route but accomplished essentially the same function

          Comment

          Working...