Access 2010 Navigation Forms DoCmd.BrowseTo Issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hyperpau
    Recognized Expert New Member
    • Jun 2007
    • 184

    Access 2010 Navigation Forms DoCmd.BrowseTo Issue

    Hi All,

    It's nice to be back.
    I just got my hands on Access again and I was surprised that the magic is still there.

    However, the new Navigation Forms in 2010, replacing the switchboard, is new to me. Nevertheless, I figured it out right away, except with one issue.

    I can't seem to get the acDataMode to work!
    No matter what I choose, acFormEdit, acFormAdd, asFormReadOnly, etc, access seem to ignore this and just simply browses to the form in normal mode.

    Googled every possible keyword combination but I have found nothing. Not even on the MicroSoft site.

    What am I supposed to do?
    Am I missing something?

    Code:
    DoCmd.BrowseTo acBrowseToForm, "frmEmployee", "Main.NavSub", , , acFormAdd
    Please help me. I am pulling my hair on this last piece of my program.

    Thanks in advance. I hope the masters, like NeoPa, would be able to read this and help me out once again.
  • topher23
    Recognized Expert New Member
    • Oct 2008
    • 234

    #2
    What is the context in which you're using this command? FWIW, I only know of two "issues" with BrowseTo. First and foremost, the form needs to be open in order for it to work (it isn't an implicit OpenForm). Second, if you are running data from a form and just trying to change the data mode of a subform on that form, entering the Path statement can cause it to fail. I think it's more likely that the second one is your issue, but without any other context I don't have a specific answer.

    Comment

    • hyperpau
      Recognized Expert New Member
      • Jun 2007
      • 184

      #3
      Hi topher! Thank you very much for your attention.

      You are correct. My concern is the second one.
      The forms are already preloaded on to the different nav tabs of my nav form, so 'the form needs to be open in order for it to work' is covered. :)

      So my issue really is that I want to change the data mode of my Form.

      SO basically, the setup is this.

      Main Form with a NavigationSubfo rm

      Inside the Navigation Subform, I have my forms frmEmployees, frmEvents, and frmModules preloaded.

      I have a button on the Main Form which says 'Create New Employee record'.

      What I want is that if I click that button, I want to browse to the Nav tab where frmEmployees is loaded, but I want to go there in Data Entry Mode.

      What happens is that my acFormAdd is being ignored.
      I am still routed to the right tab but I end up on the first record of the form. The frmEmployees does not have any subform. so basically, it's like MainForm.Naviga tionSubform > frmEmployees

      How can I make the Data Mode work? Thanks.

      Comment

      • topher23
        Recognized Expert New Member
        • Oct 2008
        • 234

        #4
        Since it's the second issue, try just using
        Code:
        DoCmd.BrowseTo acBrowseToForm, "frmEmployee", , , , acFormAdd
        For some very strange reason not addressed by Microsoft, the PathToSubFormCo ntrol variable seems to override the DataMode. So, although it's not intuitive to leave the Path variable blank, it should fix the DataMode. Let us know if that solves the problem.

        Comment

        • hyperpau
          Recognized Expert New Member
          • Jun 2007
          • 184

          #5
          Hi Topher,

          The suggestion you gave works but it is not what I'm looking for.
          What it did is it closed my Navigation Form and opened the frmEmployees in DataEntry mode, as if I used DoCmd.OpenForm.

          What I wanted is to go to the Employees tab of my Navigation Form on DataEntry mode.

          However, I found a workaround.
          I deleted all pre-loaded forms on my Navigation Form's tabs and just left out 1 tab.

          Now, the BrowseTo method simply loads my desired form onto the tab and the Data Mode loads correctly.
          If I call on other forms using the BrowseTo method, it simply replaces the current form in the NavSub with the new form I call for.

          It gets the job done, although I really wanted to have the forms already loaded on other tabs of my Nav Form.
          Anyway to have this done? Thanks.

          Comment

          • topher23
            Recognized Expert New Member
            • Oct 2008
            • 234

            #6
            I realized that the method I gave you (not giving the path) is actually a solution for when you call BrowseTo from inside the subform. However, I think I see now what the real issue is. When you specify the path to the subform, the BrowseTo statement expects a change in the SourceObject. However, since you're calling out the same form that is already loaded, it's not re-opening the subform in the new DataMode. The only way I can think of to change the DataMode in the way that you want is to first clear the SourceObject by using
            Code:
            Forms!Main!NavSub.SourceObject = ""
            and then using your BrowseTo statement to refill the subform with the proper DataMode.

            Comment

            • hyperpau
              Recognized Expert New Member
              • Jun 2007
              • 184

              #7
              The problem with this is that it changes the SourceObject of whichever is the active tab on the Navigation Form. Not really the Tab where that form is already pre-loaded.

              So basically, it just acts the same way as deleting the tabs, and just having one tab in my Nav Form.

              Comment

              • zmbd
                Recognized Expert Moderator Expert
                • Mar 2012
                • 5501

                #8
                hyperpau

                The problem is that the ACC2010 Navigation control is a new beast that is poorly documented:

                Please read the following threads, I cover some of the aspects of the Navigation Control that you are haveing issues with -

                Other than this first one, in no particular order:
                [*]http://bytes.com/topic/access/answer...gation-control
                >>(1) The navigation control, despite appering as a tab control really is not; therefor, the information contained within the article you posted to does not pertain.
                [*]http://bytes.com/topic/access/answer...nt-tab-clicked
                >>Read "Best Answer"
                >>The remaining thead has some context on the control
                [*]http://bytes.com/topic/access/answer...gation-control
                >>THis will show you just how bad a lot of the reference material available on this control was (and to a great degree still is) when trying to learn the control. Also a simple solution to a complex question.

                [*]http://bytes.com/topic/access/answer...-dialog-window
                >> A work around for something you might run into, just keep this handy... it also has a few other links.
                [*]http://bytes.com/topic/access/answer...ntrol-subforms
                >>Read post #2 and Post#4 - I really should merge these two (^_^)

                and I hope that this google-search return works the way it's supposed to as there are other threads here that cover this information too:


                I'm updating an old frontend to use this new control; thus, I've learned a lot about it thru the school of hard knocks. Any further questions let us know.

                Comment

                Working...