none
Using BrowseTo and Navigation Form in Access 2010

    Question

  • I am having a lot of problems using the BrowseTo command in VBA to navigate to a particular form that is part of a two level Access 2010 Navigation Form.  

     

    I have a dialog box in which the user selects some information that they want to see in the Navigation Form.  When the user clicks to see the details, I try the following

    Docmd.BrowseTo acBrowseToForm, "Full Form Name Of the Form That Should Load", "Navigation Form.NavigationSubform", "CRITERIA"

    If I leave out the path, the form opens in a new window at the correct record.  When I try the path (which is correct since it is the default object and names), I get an error that the macro action BrowseTo requires a valid Path argument, error 6054.

    The clicking of a top tab (NavigationButton30) and then a side tab (NavigationButton41) does load the form in the navigationsubform that I try to load with the browse to command.

    Any help or suggestions would be greatly appreciated as I do this for several different forms in the navigation window.

     

    Many thanks,

    David

    Saturday, March 12, 2011 5:02 PM

Answers

  • Are you sure you just using a double level nav form? If you are, then in the full path name of your form to show, you use JUST the simple form name.

     

    Eg:

      

    Docmd.BrowseTo acBrowseToForm, "frmCustomers", _

                   "Navigation Form.NavigationSubform", _

                   "CRITERIA"

      

    So, if you have a double level nav control, you STILL are only one sub form deep, and thus you do not need to use some special path name format for the form to show.

     

    The pair of form>subform is only needed if you attempting to replace what form shows in a forms sub form.

     

    So, as long as you are simply using the plane jane form in the above for to load + displays, as long as the form actually is placed somewhere in the nav control, it will jump to and highlight (and if the form is NOT in the nav control, then the existing one will be used and no active switch in the nav control occurs.

     

     

    Albert D. Kallal

    Edmonton, Alberta Canada

    • Marked as answer by Bruce Song Monday, March 21, 2011 6:37 AM
    Monday, March 14, 2011 11:03 PM

All replies

  • Are you sure you just using a double level nav form? If you are, then in the full path name of your form to show, you use JUST the simple form name.

     

    Eg:

      

    Docmd.BrowseTo acBrowseToForm, "frmCustomers", _

                   "Navigation Form.NavigationSubform", _

                   "CRITERIA"

      

    So, if you have a double level nav control, you STILL are only one sub form deep, and thus you do not need to use some special path name format for the form to show.

     

    The pair of form>subform is only needed if you attempting to replace what form shows in a forms sub form.

     

    So, as long as you are simply using the plane jane form in the above for to load + displays, as long as the form actually is placed somewhere in the nav control, it will jump to and highlight (and if the form is NOT in the nav control, then the existing one will be used and no active switch in the nav control occurs.

     

     

    Albert D. Kallal

    Edmonton, Alberta Canada

    • Marked as answer by Bruce Song Monday, March 21, 2011 6:37 AM
    Monday, March 14, 2011 11:03 PM
  • Many Thanks.  It is now working.

     

    -David

    Tuesday, March 22, 2011 12:27 AM
  • How did you solve the problem??


     

    Friday, May 27, 2011 6:56 AM
  •  I would like to know how you got it to work as well. I am getting the same error, even though I have entered the command just as suggested by Albert.

    DoCmd.BrowseTo acBrowseToForm, "frmGuestInfo", "Main.NavigationSubform"

    I tried changing the name of my navigation form in case the name "Main" was a problem, but that did not solve the problem.


    Regards,

    Sean

    Thursday, September 01, 2011 4:38 PM
  • OK, I found the answer to my problem here http://blogs.office.com/b/microsoft-access/archive/2010/02/24/access-2010-browseto-docmd-and-macro-action.aspx. "The first form in the path must be the form that is currently loaded directly in the Access window (or browser window if the application is running on the web.) This means that the Path parameter only allows you to change the contents of acurrently-visible subform control."

    Since I was using a search form called from the navigation form, all I had to do was close the search form before using the BrowseTo command. Now it works fine.

    Regards,

    Sean Cosgrove

    P.S. Cannot get the where part to work, but I'm (pretty) sure I'll be able to figure that out.


    P.P.S. Maybe not so sure - here is a post about my failure to get the where condition to work: http://social.msdn.microsoft.com/Forums/en-US/accessdev/thread/8ddee4ea-32a9-4c14-9f34-bcb3859b9f19
    Friday, September 02, 2011 12:12 PM
  • Hello, I am really struggling with the path part of the macro… can you use browseto on a page in a tabbed main form, or can you only use it in a navigation form?

    I am trying to duplicate the address book example listed here: http://blogs.office.com/b/microsoft-access/archive/2010/02/23/access-2010-browseto-docmd-and-macro-action.aspx

    I have a main form called Child Census. There are multiple tabbed pages, one of which is named “Adult Info”. On this page, I have a subform control named AdultSFCont and a subform named Adult Lookup Subform.

    I have placed a continuous form next to the Adult Lookup Subform named AdultList. This is linked on child id to the main form, Child Census. So, my continuous form shows me a list of all of the adults that are related to a child. (like the example list of contacts in the address book) I would like to click on the adult name, and use the browse to function to bring up that adults’ detail record (similar to the address card show in the example) I have tried several attempts to get the file path right and I am not getting it to work. Can you offer any suggestions?

     

    Thank you so much!



    Char T
    Sunday, October 02, 2011 7:05 PM
  • I don't really think you need a browseto command here? Browseto can be used for a filter, but it is more for opening a form "in place"

    You could just perhaps set a filter on the other sub form?

    In fact even better is to setup the link master/child settings for that other sub form to be based on the sub-form that selects the adults.

    linkChildFields      main_id        (whatever is the name of the field in
    this sub-form that is used to relate back to the parent table of adults)
    LinkMasterFields    [AdultsDS].[form].[ID]   ("adultsDS is that continues form that selects the adult.

    In fact, this would suggest that you only need one line of code in the on-current event of  the continues adults form.

    Me.parent.AdultSFCont.Requery

    The above is the least amount of code (one line of code). Another way is to simply set the forms data source like this in the on current event:

    Me.Parent.AdultSFCont.RecordSource = "select * from tblAdults where id = " & me!id

    Either way should work, and as noted I don't think browseto is required here at all.  And before I would use browseto, you likly would find using a filter is easier to setup.

    Albert D. Kallal  (Access MVP)
    Edmonton, Alberta Canada


    • Edited by Albert D. KallalMVP Monday, October 03, 2011 2:17 AM changed RowSource to RecordSource
    Sunday, October 02, 2011 11:02 PM
  • Hello Albert, thank you so much for a light at the end of the tunnel... i have been going in circles all day :( I will try your suggestions when I can have a fresh perspective in the morning. Again, thank you very much for the input! Char
    Char T
    Sunday, October 02, 2011 11:25 PM
  • You are welcome. Keep in mind setting the rowsource directly is only avaiable in VBA or non web  based applications (so it not clear which system you are using here). If this is web based, then you have to use setfilter and you cannot stuff the recordsource propertiy as I suggested (this only works in client based applications, not web based).

     

    Albert k.

     

    Monday, October 03, 2011 2:16 AM
  • Hello- its just a simple db that runs over a network,  one back end and local front ends on each computer... but I might be moving in the direction of web based, so should i keep that in mind? I am not sure what the implications might be... i guess at this point i just want to get something done and working, its been a long project (volunteer) for a local non profit in our town.

    Regarding your suggestion above, where would i put the code you recommend? I am not sure if all the code is used or just part of it, or where it needs to go... sorry i am not very good at this, but i do want to learn!


    Char T
    Monday, October 03, 2011 2:03 PM
  • Hello Albert, I have been trying to get this to work for several hours. I must be doing something wrong, or, I may not have described my goal clearly enough to begin with...

    I would like to use a continuous form with an on click event to generate the correct record in an adjacent form.

    The subform that generates the list is a continuous form, named "AdultList" who's record source is a query that selects adults that have a relationship with the current child in the main form, and includes the fields "Child id" "adult id" and "adult name". The criteria for the child id is set as the child id in the main form. This seems to be working correctly, if i select a child in my main form, the list of adults that are related are produced in the continuous form.

    The adjacent subform, named "RelationshipLookup" who's record source is a query that selects the table named "Relationships" and includes the field "adult id" and "child id"; is linked on child id to the main form. This subform also is working correctly, when a child is selected in the main form, only those adults records are generated. This form's view is set to single form. This form is for entering the details of the relationship, such as biological parent, foster parent, etc.

    My goal is to be able to click on a name in the continuous form on the left side of the page, and have that record generated in the adjacent (single form view) form on the right side of the page.

    I am sorry to bother you again, but I have tried to do this on my own and i am just not getting it. Can you help again please?


    Char T
    Saturday, October 08, 2011 3:28 PM

  • Char T
    Saturday, October 08, 2011 3:52 PM