mashman:
So that we are on the same page:
- You have a form.
- On that form you have inserted the Navigation Control.
- In the Navigation Control you have a series of buttons/tabs that either run along the top, down the left side or both
- You are currently in a tab named ?
- You would like to move to a tab named "navViewOrder"
Just as an example this:
-->[2013-12-19]---> Because I don't want to lose this information about Navigation Subforms I thought, where better than to store it here? The information is a tad eaiser to find now with a search; however, still no really good explanations:
Here's the deal with the navigation control:
1) Unless renamed, the default name for the navigation control is "NavigationSubform" and we need to confirm this or confirm the name of the "NavigationSubform" control.
- To confirm this, open your form in design view.
- Show the properties dialog for any control on the form OTHER than the "NavigationSubform" - selct the parent form header or the parent form details.
- Now in the propeties box, in the dropdown, you should see either the default name of "NavigationSubform" or the name you gave it.
2) Every time you click on a navigation button/tab (NavBtn), or navigate to it using VBA, the current form is unloaded the form associated with the newly selected NavBtn is loaded. Thus, any values on the form you were on are lost unless you pass them in the calling code or store the value in a global type variable.
- in effect, this is a late binding tab form without the benfit of keeping the values from the other tabs.
- the positive, every time the form loads, it requeries and runs the onload/open/etc events.
3) It doesn't matter what NavBtn you click on, the form associated with that control is loaded and you refer to it as follows
- from the parent: me.NavigationSubform.Form![boundcontrolname]
- from within the loaded form me.[boundcontrolname]
4) To go from one navigaton control to another, you need something like this:
For a simple movement between forms, then ignore the ">" redirect as given in the link, just follow:
So I'm on a differenet form and have a command button or perhaps one of the controls has an on click for details so I need to go to the form "frm_qry_asset_inventory_logbook" for the details then:
-
DoCmd.BrowseTo objecttype:=acBrowseToForm, _
-
objectname:="frm_qry_asset_inventory_logbook", _
-
PathtoSubformControl:="frm_navigation.navigationsubform", _
-
WhereCondition:="Inventory_pk = " & [Inventory_pk]
The "objectname" is the name of the FORM that is loaded by clicking on the NavBtn, NOT the name of the NavBtn
The "WhereCondition" is a valid SQL "WHERE" clause
Select.... WHERE("Inventory_pk = " & [Inventory_pk])
this sets the filter for the loaded subform.
5) to set the focus on a control in the newly loaded subform it is a two step process you will need somethin like this:
so we move to the form "frm_loanaccounts" that loads in the navigationsubform control and we want to set focus to the combobox for new customers named "zcbo_newcustomer"
- DoCmd.BrowseTo objecttype:=acBrowseToForm, _
-
objectname:="frm_loanaccounts", _
-
PathtoSubformControl:="NavigationForm.navigationsubform"
-
With Forms.Item("NavigationForm").navigationsubform
-
.SetFocus
-
!zcbo_newcustomer.SetFocus
-
End With
NOTE THE BANG for the control
>that should cover a few things and I hope is useful for those hunting for information about the ACC2010 and later Navigation Subform Control