Link to home
Start Free TrialLog in
Avatar of jbakestull
jbakestull

asked on

Access subfroms

I have two subforms bounded to frmUSHS Main.

Subfroms are called:

FrmUSHSPool
FrmUSHSFamily

I need to reference a control source (txtintCSP#) from FrmUSHSPool to FrmUSHSFamily

I've tried =[frmUSHSPool].[Form]![txtintCSP#],, but not having a good understanding on how to reference subfrom controls from on to another.
Any help would be grateful.
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Try this:

 =Forms!frmUSHS!frmUSHSPool!Form![txtintCSP#]
If the Subforms are on the same Parent form, you can also do this:

Me.Parent.NameOfYourSubformControl1.Form.YourControl

Note that "NameOfYourSubformControl1" is the name of the Subform Control on the form, and may or may not be named the same as the Form you're using as a subform.

So if your Subform CONTROL is named "FrmUSHSPool":

Me.Parent.FrmUSHSPool.Form.YourControl
but not having a good understanding on how to reference subfrom controls from on to another.

Main form Contains Controls, like TextBox, CommandButton, and Subform control.

In your setup you have:
Main Form: frmUSHS Main.
Subfrom Control: FrmUSHSPool
Subfrom Control: FrmUSHSFamily
Subfrom Control: FrmUSHSPool
This subform control has a Control source, which is a Form (yes a form in the navigation pane)
Access by default names the subform control with the same name as the form, if you drag the form from the navigation pane to the Main form in design mode. But it should not be.
This form has controls like [txtintCSP#]. In the same form it is referred to as [txtintCSP#], but outside theat form, you use: MainForm!SubFormControlName!ControlSourceOfSubForm.Form![txtintCSP#]
 frmUSHS![frmUSHSPool].[Form]![txtintCSP#]
Subfrom Control: FrmUSHSFamily
This subform control has a Control source, which is a Form (yes a form in the navigation pane)
The same applies to other subform FrmUSHSFamily.
 frmUSHS![FrmUSHSFamily].[Form]![txtintCSP#]

This reference always gives the right value.

If you are inside one subform, you can refer to a control in the other subform using the full
path as explained.
Access offers shortcuts to help programmers.
If you are in subform frmUSHSPool and want to use a control in FrmUSHSFamily using the shortcuts.
It works like this: use the control named x which resides in another subform which is my sister (both subforms are on the same main form). Sister calls her sister's control x  by saying Me.Parent!Sister.Form!x
Avatar of jbakestull
jbakestull

ASKER

I'm still not having any success. I've attached a copy of database.

What I'm trying to do is reference control value txtintCSP# from subform frmUSHSPool onto main form (accomplished) and sub-forms frmUSHSFamily and frmUSHSFamilyMembers.
subform.accdb
ASKER CERTIFIED SOLUTION
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial