By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,917 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,917 IT Pros & Developers. It's quick & easy.

Navigation Control - Subforms

P: 5
Hi guys,

I have in the past referred to controls on subforms without any issue, however with the new navigation control there does not seem to e a subform to refer to other than NavigationSubForm.

I have tried the following:

Me![NavigationSubform]![prjCustomer] = Forms![menu]!cmbCustomer
Me![NavigationSubform]![cCustomer] = Forms![menu]!cmbCustomer

I have also tried:

Forms![Menu]![NavigationSubform]![prjCustomer] = Forms![menu]!cmbCustomer
Forms![Menu]![NavigationSubform]![cCustomer] = Forms![menu]!cmbCustomer


This only works when the subform has the focus i.e. if I am on the Project Overview Subform then the prjCustomer field is updated with the value in cmbCustomer, but the cCustomer field comes up with an error saying it cannot find the field.

If I move onto the Contacts form then the cCustomer field updates with the value in cmbCustomer, but the prjCustomer field comes up with an error saying it cannot find the field.

Essentially I want to have a field on my Navigation Control called cmbCustomer and when I update this I want the value to be written into every Customer field on each of the subforms on the Navigation Control. This is so the user only has to select customer once and all the data entry on the other forms will automatically be updated with the customer name.

Hope that makes sense - any light someone can shed on this would be appreciated.
Nov 17 '13 #1

✓ answered by zmbd

ccocker:

Hang tight!
I had one (many explictives) learning to use this control.

Things to keep in mind:
- The new navigation pane works much like a late bound tab control. It is NOT however at all like a tab control
- Each time you click on a new navigationcontrol button/tab, the associated subform is RELOADED from SCRATCH. The subform on the control that you were on is UNLOADED; thus, anything that you had set on that form is NO LONGER available! You have to use the onclose events, temp and module level variables, and other tricks to preserve and transfer the infromation.
- There is ONE navigation control container on the parent form. This is where all of the subforms refered to by the navigation button/tabs will load. Therefor, ignore the button name and go from the parent to the navigation control then the subform therein.
This will sometimes get you the correct reference and helpeed me a few times: How to refer to subforms in control sources There's a trick to this with the navigaton control - while in design view make sure that the correct subform is showing... and this doesn't always work.
Your basic reference is something like this and assumes that you haven't changed the default navigation container name:
[Forms]![frmParentform]![frmNavigationsubform].[form].(somecontrolhere)

I'll update here with a better example in a few hours after I get a nap and goto work :)

()Also, almost as an aside this is a very handy link to have when working with subforms and was actually of some use while trying to learn the new nav control:
Refer to Form and Subform properties and controls

I'm glad this worked out.
By way of finishing the reference as promised in my first post :)

So I have a calculated control that requires the value from the subform of the parent form within the navigation control.
Unless you have subforms within subforms this is more than likely as bad as it gets.

So We have three forms involved here:
frm_navigation: This is the switchboard. It has all the pretty buttons along the top and side for user navigation.
frm_qry_asset_inventory_logbook: This is the parent form that is bound to the navigation control button. It's a fairly complex query driving this form; however, as one scrolls or searches within this form for an asset, the subform pulls the historical information.
sfm_qry_asset_inventory_logbook this is the subform frm_qry_asset_inventory_logbook that pulls the related records from the history/logbook table for the selected asset in the parent.

We then have the bound control on the subform that I'm after:
[history_fk_inventory] which is bound to that recordsource field in the sfm_qry_asset_inventory_logbook form. I need to pull this value into a control on the parent for a calculation.

So this is what it looks like in the calculated control (ok only partially this has a very long set of calcs)
Expand|Select|Wrap|Line Numbers
  1. =[Forms]![frm_navigation]![NavigationSubform].[Form]![sfm_qry_asset_inventory_logbook]![history_fk_inventory]
so to break this down by step:

Expand|Select|Wrap|Line Numbers
  1. [Forms]!                '<Forms Collection 
  2.                            of the database
  3.  
  4. [frm_navigation]!       '<The Switchboard form
  5.  
  6. [NavigationSubform].    '<The default name of the
  7.                            new Acc2010 navigation control
  8.  
  9. [Form]!                 '<Tells us to look at 
  10.                              the form property of the
  11.                              navigation control, 
  12.                              in this case it 
  13.                              is the parent form: 
  14.                              frm_qry_asset_inventory_logbook
  15.  
  16. [sfm_qry_asset_inventory_logbook]! '< This is the subform of the 
  17.                              Currently loaded parent form
  18.  
  19. [history_fk_inventory]  '< and finally the 
  20.                              control of interest. <
So that got me to the control on the subform of the parentform loaded into the navigationcontrol.

What if we needed to get a control on the currently loaded form in the navigation control (we're still using the three afor mentioned forms here):
Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_navigation]![NavigationSubform].[Form]![Inventory_pk]
Note I did not use "frm_qry_asset_inventory_logbook"

In fact, if you clicked on a second button, and it loaded a new form (say frm_example2) with the bound control named "[example_pk]" then the reference to that control would be
Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_navigation]![NavigationSubform].[Form]![example_pk]
Clear as mud... was for me too.

Fourtunately however, when working within the loaded form; the "ME." construct holds true as does any of the references internally to the form using "Me." and the normal subform references (for example say:
in vba:
sfm_qry_asset_inventory_logbook
wanted to address the recordset for:
frm_qry_asset_inventory_logbook
(both of which are currently loaded into "NavigationSubform"

then the in vba code within "sfm_qry_asset_inventory_logbook" need only use the construct: Me.Parent.RecordSource and other constructs as shown in the link provided earlier.

-
Moveing data: there is, in the navigation control, the tab (button) that is associated with the form, a property, "Navigation Where Clause"
I've just started playing with this... taking the inventory forms... I have a tab that loads the inventory form... I already have a tab that has the history details... so I've been working with this property so one could select the item in the inventory pane and go directly to that item in the history side.

Share this Question
Share on Google+
6 Replies


zmbd
Expert Mod 5K+
P: 5,397
ccocker:

Hang tight!
I had one (many explictives) learning to use this control.

Things to keep in mind:
- The new navigation pane works much like a late bound tab control. It is NOT however at all like a tab control
- Each time you click on a new navigationcontrol button/tab, the associated subform is RELOADED from SCRATCH. The subform on the control that you were on is UNLOADED; thus, anything that you had set on that form is NO LONGER available! You have to use the onclose events, temp and module level variables, and other tricks to preserve and transfer the infromation.
- There is ONE navigation control container on the parent form. This is where all of the subforms refered to by the navigation button/tabs will load. Therefor, ignore the button name and go from the parent to the navigation control then the subform therein.
This will sometimes get you the correct reference and helpeed me a few times: How to refer to subforms in control sources There's a trick to this with the navigaton control - while in design view make sure that the correct subform is showing... and this doesn't always work.
Your basic reference is something like this and assumes that you haven't changed the default navigation container name:
[Forms]![frmParentform]![frmNavigationsubform].[form].(somecontrolhere)

I'll update here with a better example in a few hours after I get a nap and goto work :)

()Also, almost as an aside this is a very handy link to have when working with subforms and was actually of some use while trying to learn the new nav control:
Refer to Form and Subform properties and controls

I'm glad this worked out.
By way of finishing the reference as promised in my first post :)

So I have a calculated control that requires the value from the subform of the parent form within the navigation control.
Unless you have subforms within subforms this is more than likely as bad as it gets.

So We have three forms involved here:
frm_navigation: This is the switchboard. It has all the pretty buttons along the top and side for user navigation.
frm_qry_asset_inventory_logbook: This is the parent form that is bound to the navigation control button. It's a fairly complex query driving this form; however, as one scrolls or searches within this form for an asset, the subform pulls the historical information.
sfm_qry_asset_inventory_logbook this is the subform frm_qry_asset_inventory_logbook that pulls the related records from the history/logbook table for the selected asset in the parent.

We then have the bound control on the subform that I'm after:
[history_fk_inventory] which is bound to that recordsource field in the sfm_qry_asset_inventory_logbook form. I need to pull this value into a control on the parent for a calculation.

So this is what it looks like in the calculated control (ok only partially this has a very long set of calcs)
Expand|Select|Wrap|Line Numbers
  1. =[Forms]![frm_navigation]![NavigationSubform].[Form]![sfm_qry_asset_inventory_logbook]![history_fk_inventory]
so to break this down by step:

Expand|Select|Wrap|Line Numbers
  1. [Forms]!                '<Forms Collection 
  2.                            of the database
  3.  
  4. [frm_navigation]!       '<The Switchboard form
  5.  
  6. [NavigationSubform].    '<The default name of the
  7.                            new Acc2010 navigation control
  8.  
  9. [Form]!                 '<Tells us to look at 
  10.                              the form property of the
  11.                              navigation control, 
  12.                              in this case it 
  13.                              is the parent form: 
  14.                              frm_qry_asset_inventory_logbook
  15.  
  16. [sfm_qry_asset_inventory_logbook]! '< This is the subform of the 
  17.                              Currently loaded parent form
  18.  
  19. [history_fk_inventory]  '< and finally the 
  20.                              control of interest. <
So that got me to the control on the subform of the parentform loaded into the navigationcontrol.

What if we needed to get a control on the currently loaded form in the navigation control (we're still using the three afor mentioned forms here):
Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_navigation]![NavigationSubform].[Form]![Inventory_pk]
Note I did not use "frm_qry_asset_inventory_logbook"

In fact, if you clicked on a second button, and it loaded a new form (say frm_example2) with the bound control named "[example_pk]" then the reference to that control would be
Expand|Select|Wrap|Line Numbers
  1. [Forms]![frm_navigation]![NavigationSubform].[Form]![example_pk]
Clear as mud... was for me too.

Fourtunately however, when working within the loaded form; the "ME." construct holds true as does any of the references internally to the form using "Me." and the normal subform references (for example say:
in vba:
sfm_qry_asset_inventory_logbook
wanted to address the recordset for:
frm_qry_asset_inventory_logbook
(both of which are currently loaded into "NavigationSubform"

then the in vba code within "sfm_qry_asset_inventory_logbook" need only use the construct: Me.Parent.RecordSource and other constructs as shown in the link provided earlier.

-
Moveing data: there is, in the navigation control, the tab (button) that is associated with the form, a property, "Navigation Where Clause"
I've just started playing with this... taking the inventory forms... I have a tab that loads the inventory form... I already have a tab that has the history details... so I've been working with this property so one could select the item in the inventory pane and go directly to that item in the history side.
Nov 18 '13 #2

P: 5
Thank you - very helpful. I get why it was not working now, you forced me to re-think my approach.

So I essentially just created a public function to get the value from the combobox on the main form (so it is always accessible to me). Then on each subform I just call the function and assign it to the field on the subform I am on using the Me! feature.

Sometimes approaching something in the opposite way to the way you are trying works :-)

@zmbd
Nov 18 '13 #3

P: 1
I actually became a member of this site just to say thank you to zmdb!!
Finally something that can help me with this navigational crap!

Thanks!!
Apr 15 '15 #4

P: 1
@ZMBD I've been searching for this solution for daysss now, and was about to give up! thanks so much for the detailed solution. Wish u health strength and good deeds your way!
btw, I too created an account just to say thanks, lol
Sep 30 '15 #5

NeoPa
Expert Mod 15k+
P: 31,492
It's very nice of both of you to take the time and effort to reply as you have. I know ZMBD will be thrilled when he sees this, and so he should be. He deserves it.
Oct 1 '15 #6

P: 1
Count me in as one creating an account to just say thank you.

Lamar
Jan 14 '19 #7

Post your reply

Sign in to post your reply or Sign up for a free account.