Switch Between Tabs in Navigation Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahd2008
    New Member
    • Nov 2008
    • 68

    #1

    Switch Between Tabs in Navigation Form

    Good day all,

    Can anyone enlighten me on how to switch between tabs in navigation form? My navigation form has 5 tabs, and for some reasons I need a code to switch, between those tabs.

    I have searched the web, but unfortunately nothing worked out.

    Thanks
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    I don't use tabs (or Pages) much, but I suggest you do select a control found on it to switch to it. Like Sections, I'm not aware of any way to switch focus to them directly (without selecting a specific control on them).

    Comment

    • ahd2008
      New Member
      • Nov 2008
      • 68

      #3
      Thanks so much for your response; I appreciate your suggestion. However, can you tell me how to do select control found or how to implement your suggestion ?

      Any idea will be much appreciateled

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Rather than spelling out the details in the answer, that you should include in the question, I'll wait for some sensible details and reply using those if you don't mind. It's not fun working blind at the best of times, but completely blind because you haven't included any details in your question is not how things should be ;-)

        Comment

        • ahd2008
          New Member
          • Nov 2008
          • 68

          #5
          Thanks Neopa for you kind support. Yes, you are totally right; I should have included more details.

          Well, as stated in my first post I have a navigation form that has 5 tabs. The navigation form’s name is "ManageProfiles ", and the tabs' names in order are:

          1-EmployeesProfil e
          2-EvaluatorsProfi le
          3-MentorsProfile
          4-Registration
          5-WorkingSchedule

          On clicking on WorkingSchedule tab, I navigate to the "WorkingSchedul e Form" which is embedded in the navigation subform. It allows the user to see the schedule of each employee and their courses as well. Now, I need to write a code so when user clicks on a certain course, it switched directly to the Registration Tab, and filter through the records to bring up that particular course to allow the user to change the date.

          The question now is how to switch to Registration tab?

          Thanks in advance

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Much better, BUT...

            If you want code to switch to the [Registration] tab, then you need to include the name of a control that is found on that tab. A SubForm control is fine, but whichever control you choose will be selected when the switch is made.

            You also need to include details of what it is that will trigger the code to run. If that is a click somewhere, then the name of the somewhere must also be included. It's a good idea to indicate names within []. It's not always necessary, but it does indicate clearly what is actually the name and what is part of your text.

            Comment

            • Mihail
              Contributor
              • Apr 2011
              • 759

              #7
              Code:
              TabControlName.Pages("VBA_PageName").SetFocus
              or, using pages indexes,
              Code:
              TabControlName.Value = IndexValue

              Comment

              • ahd2008
                New Member
                • Nov 2008
                • 68

                #8
                Neopa Thanks for your usual support. I have tried all methods of finding a control on the [Registration] tabs, but nothing worked out. Luckly, while searching the web, I found a post in a forum similar to my case. I found out that the way to switch from one tab to another in "Navigation Forms" is to change the SourceObject of the Subform Control. So, the code to carry out this task is:

                Code:
                Forms![ManageProfiles].[SubNavigation].SourceObject = "EmployeesCourses"
                Note: [EmployeesCourse s] is the form embeded in Subform Control of Navigation Form.

                Again, Thanks for your help
                Last edited by NeoPa; Apr 24 '12, 11:52 AM. Reason: Forgot to add the reference link - Sorry, had to remove illegal link.

                Comment

                • ahd2008
                  New Member
                  • Nov 2008
                  • 68

                  #9
                  Mihail, Thanks for your inputs. I believe your codes would work with on forms based on Tab Control, but not with navigation forms.

                  Thanks all

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32669

                    #10
                    I'm confused. Your solution doesn't fit the question at all as far as I can see.

                    I guess (from what you have now included in your answer) that the subform control found on the tab (Page) in question is actually called [SubNavigation] (My question #1). As such, my answer would have been (due to the lack of an answer to question #2 I can't illustrate this in context) :
                    Code:
                    Call Me.SubNavigation.SetFocus()
                    It may well be that Mihail's answer, if it works, is actually a better one anyway. I was under the impression that Tab controls could not be selected directly. Possibly I was confusing this with the fact that a reference to a control within a Tab doesn't need any reference to the Tab's name in it.

                    If, as seems possible now, you were really after a way of changing the form that's shown within a subform on your main form, then your solution should be :
                    Code:
                    Me.SubNavigation.SourceObject = "EmployeesCourses"

                    Comment

                    • Israel h
                      New Member
                      • Apr 2014
                      • 1

                      #11
                      Try This:
                      Code:
                      DoCmd.BrowseTo ObjectType:=acBrowseToForm, _ 
                                     ObjectName:="EventDS", _ 
                                     PathToSubformControl:="Main.NavigationSubform", _ 
                                     WhereCondition:="", _ 
                                     Page:="", _ 
                                     DataMode:=acFormEdit
                      Last edited by NeoPa; Apr 15 '14, 03:56 PM. Reason: Added mandatory [CODE] tags for you.

                      Comment

                      • zmbd
                        Recognized Expert Moderator Expert
                        • Mar 2012
                        • 5501

                        #12
                        Just because this thread popped up:
                        A few other threads about this control - for those that come across this thread - dealing with a few different issues:
                        Last edited by NeoPa; Apr 16 '14, 11:53 PM. Reason: I guessed this is what you intended. If not then you can easily fix it yourself I guess.

                        Comment

                        • kcbehnet
                          New Member
                          • Aug 2014
                          • 5

                          #13
                          Try this in your code

                          Code:
                          Me!NavigationSubform.SourceObject = "FORM NAME"
                          FORM NAME = the page you want to open in the subform area of the Navigation form
                          Last edited by zmbd; Aug 25 '14, 01:18 PM. Reason: [z{added required code tags}]

                          Comment

                          • zmbd
                            Recognized Expert Moderator Expert
                            • Mar 2012
                            • 5501

                            #14
                            kcbehnet
                            Me!NavigationSu bform.SourceObj ect = "FORM NAME"
                            kcbehnet
                            You will find that only works {as expected} in a tabbed form control {the code in an ACC2010 navctrl results in a fresh reload of the subform; thus the info in the prior form is lost an as writen doesn't work from within the subform}

                            This will not work in the new ACC2010/newer NavigationForm Control {as one would expect. The original question was modified in post #5}

                            The way to move from one NavigationFormC ontrol-tab to the other {and have the data filted as requested in post #5} is to use the "DoCmd.BrowseTo " method.

                            Please refer to the links as provided in my prior post for more detail about the newer ACC2010/newer NavigationForm Controls. (^_^)
                            Last edited by zmbd; Aug 26 '14, 11:41 AM. Reason: [z{added the proper detail}]

                            Comment

                            • twinnyfo
                              Recognized Expert Moderator Specialist
                              • Nov 2011
                              • 3665

                              #15
                              Z, et al,

                              For this reason, I started this thread: Is there any Value in NAvigation Forms?

                              I originally thought about posting a response to this thread, but began a new one.

                              Z, for you to have been frustrated understanding the new Nav Forms, I know they are not for me! I'm happy loading all my subforms at once into a Tab Control and being able to keep all my data!

                              :-)
                              Last edited by zmbd; Aug 25 '14, 06:32 PM. Reason: [z{NvCtrl are 2 edge sword - slick and causes spliting head aches}]

                              Comment

                              Working...