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.
Microsoft DevelopmentMicrosoft Access

Avatar of undefined
Last Comment
Hamed Nasr

8/22/2022 - Mon
mbizup

Try this:

 =Forms!frmUSHS!frmUSHSPool!Form![txtintCSP#]
Scott McDaniel (EE MVE )

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
Hamed Nasr

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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
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
Hamed Nasr

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question