Changing label in form header when different tab selected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cmartin1986
    New Member
    • Sep 2007
    • 37

    Changing label in form header when different tab selected

    Hi Guys,

    My problem today is how to change the labels in a form header when the user selects a different tab. I want it in the header instead of the tab control box because im using this is a continuous form and want to fit maximum number of records per page.

    to clarify, I have labels that say Line Unit 0001, Line Unit 0002, Line Unit 0003 eg. through Line Unit 0010. When the user selects the second tab, I want the labels to chang to Line Unit 0011 through Line Unit 0020. Thanks in advance

    Thanks,
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Why not use for each tab a separate subform that displays the needed fields ?

    Nic;o)

    Comment

    • cmartin1986
      New Member
      • Sep 2007
      • 37

      #3
      Thanks for the idea, but in this case it won't work. I have very, very partiular management. Anyone else know how... I have tried using
      Code:
       me.status_label.caption = "Line Unit 0011"
      in the on change event of the tab control. This works except when you click back to the line unit 1-10 tab it wont change the labels back. I also tried the same code in the on click event of a specific tab, but it didn't fire. The only thing i can think is some sort of toggle? code but i'm not advanced enough to write that code. ANY help is great.

      Thanks,

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Have a hard time to visualize the labels you have.
        I would expect a mainform in "single form" view with a tab control holding a datasheet subform.
        Which labels do you want to change ?
        Perhaps you can make a screenprint and add that as an attachment (first post the comment and then use the [Edit/replace] at the bottom to add the attachment) to a comment.

        Nic;o)

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I have to agree with Nico in that I can't really follow your explanation of what your labels are! But I think maybe this demo code will point you in the right direction as to how to detect when the pages change.

          The first thing to understand is that tabbed pages are indexed starting with zero, i.e. the first page has a value of 0, second page has a value of 1, third page has a value of 2, etc.

          Secondly, you need to understand that the OnClick event of a tabbed page only fires when you click on the page itself, not the tab at the top of the page!

          Lastly, you need to understand that the tabbed control change event fires anytime the tabbed pages change. But to base something on the change event, you have to identify the particular page that has focus.

          This code assumes a single label in the form header named status_label.

          [CODE=vb]Private Sub YourTabbedContr ol_Change()
          If Me.YourTabbedCo ntrol.Value = 0 Then ‘First Page
          status_label.Ca ption = "Page 1"
          ElseIf Me.YourTabbedCo ntrol.Value = 1 Then ‘Second page
          status_label.Ca ption = "Page 2"
          ElseIf Me.YourTabbedCo ntrol.Value = 2 Then ‘Third page
          status_label.ca ption l.Caption = "Page 3"
          End If
          End Sub[/CODE]

          The label will change as you click betweeen pages. Hope this helps!

          Linq ;0)>

          Comment

          • cmartin1986
            New Member
            • Sep 2007
            • 37

            #6
            Thank You guys a lot for the input. The demo code you displayed for me worked out nicely. Excactly what I needed!


            Thanks again.

            Comment

            Working...