none
Go to next navigation subform RRS feed

  • Question

  • My main form has a navigation subform, having 5 tabs. I want to go to 2 or 3rd or 4th or 5th navigation through VBA.

    I tried to use docmd.browseto  command.  But it replaces the form in current tab and all navigation tabs disappear.  

    Please help. 

    Wednesday, July 13, 2016 4:31 AM

Answers

  • To be clear, in the below screenshot I have code in the Command8 Button's click event that will take the user from form4 to form3, keeping all of the navigation buttons visible. The code uses no subform reference and is simply:

    DoCmd.BrowseTo acBrowseToForm, "Form3"


    Miriam Bizup Access MVP

    Thursday, July 14, 2016 12:41 PM

All replies

  • Can you post a screenshot of your navigation form?

    Miriam Bizup Access MVP

    Wednesday, July 13, 2016 10:10 AM
  • >>>I tried to use docmd.browseto  command.  But it replaces the form in current tab and all navigation tabs disappear.  

    According to your description, I have made a sample to try to reproduce this issue, unfortunately, I am not able.

    DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
        ObjectName:="FM_Video", _
        PathToSubformControl:="ReproduceForm.NavigationSubform"

    Before:

    After:

    So I suggest that you could provide more information about your issue, for example screenshot, sample code or database file etc., that will help us reproduce and resolve it.

    Thanks for your understanding.

    Thursday, July 14, 2016 3:10 AM
  • Hi, Thanks for Reply.  

    please see the snapshot of form and code used.

    Here main form is "AuditView".  having a navigation form "AuditViewSub", Audit Detail (as appearing) has a Source target form "AuditDetail" 

    Second tab is "Planned vs Actual "  --> Control Name : NavigationButton11  Source Target form : "PlannedvsActual"

    i am using command :

    DoCmd.BrowseTo ObjectType:=acBrowseToForm,ObjectName:="PlannedvsActual",PathToSubformControl:="AuditView.Auditviewsub"

    and output is

    But i want as this :

    Thursday, July 14, 2016 4:30 AM
  • From your screenshot, this is what I think is happening...

    You need to specify one more 'Level' in your subform path...

    Keep in mind that the 'Code, 168, Financial Year' etc tabs are handled in one subform.

    When the 'Audits' (?? I'm having difficulty reading the title in the screen shot) tab is active, you have a sub-subform involved which handles the 'Audit Detail, Planned V Actual' etc tabs. 

    You need to reference the path to THAT sub-sub form, otherwise Access will put the PlannedVSActual subform into the MAIN navigation subform control and your lower level tabs will be lost.

    By default, Access uses the name 'NavigationSubform' as the name for subform controls for navigation subforms...

    So you can try something like this (take a look in design view at the Name property of the subform controls when the Audits tab is open, and modify the 'NavigationSubform' text as needed):

    DoCmd.BrowseTo ObjectType:=acBrowseToForm,ObjectName:="PlannedvsActual",PathToSubformControl:="AuditView.NavigationSubform.NavigationSubform"

    You can also try directly changing the source object of the navigation control, which is effectively what the BrowseTo command is doing (this is assuming that this code is place in some event on the AuditDetail subform, such as the click event of the Save command button):

    Me.Parent.NavigationSubform.SourceObject = "PlannedVSActual"


    Miriam Bizup Access MVP


    • Edited by mbizup MVP Thursday, July 14, 2016 10:29 AM
    Thursday, July 14, 2016 10:27 AM
  • Thanks Miriam,

    You explained  it very nicely.

    Sorry, Snap Shot was not Clear.

    Let me explain it:

    Main form Name is : Auditview

    Sub form name is : Auditviewsub (this is navigation sub form)

    first tab caption is : "Audit Detail"   source form is : "AuditDetail"

    and second tab caption "Planned vs Actual"  sourceform is "PlannedvsActual"

    You mentioned it right that "Code" and "financial Year" are on different form (i.e. on main form namely "Auditview")

    Now come to your second solution: it gives the same result as i explained it in my first problem.  so, i think it will not best suited for me.

    In respect of your first solution, i tried code :

    DoCmd.BrowseTo ObjectType:=acBrowseToForm,ObjectName:="PlannedvsActual",PathToSubformControl:="AuditView.AuditViewSub.form.navigationsubform"

    but it gives error:

    

    please advice me again . thank you

    Thursday, July 14, 2016 11:49 AM
  • DoCmd.BrowseTo ObjectType:=acBrowseToForm,ObjectName:="PlannedvsActual"
    
    
    ' Or this...
    Me.NavigationSubform.SourceObject = "PlannedVSActual"

    Where exactly are you placing the code?

    Depending on the placement of the code, you may not need the subform path at all.  Try either of these:


    Miriam Bizup Access MVP

    Thursday, July 14, 2016 12:30 PM
  • To be clear, in the below screenshot I have code in the Command8 Button's click event that will take the user from form4 to form3, keeping all of the navigation buttons visible. The code uses no subform reference and is simply:

    DoCmd.BrowseTo acBrowseToForm, "Form3"


    Miriam Bizup Access MVP

    Thursday, July 14, 2016 12:41 PM
  • Thank you Miriam,

    Your advise works.

    Its working now.

    I was using it in immediate window.

    In forms command button it is working fine.  but not in immediate window. 

    Friday, July 15, 2016 4:54 AM
  • Glad it's sorted.   Good luck with your project.

    Miriam Bizup Access MVP

    Friday, July 15, 2016 11:39 AM