Refer to controls on a subform

  • Thread starter Karafer via AccessMonster.com
  • Start date
K

Karafer via AccessMonster.com

So I had this textbox named Staff on a subform placed in a form which is in
turn, placed in a tab control on a switchboard....how do I refer to this
control? Because in the switchboard, there will be a textbox with the name of
the staff which they entered when they logged in the database...and I want
the staff textbox in the subform I referred above to set its value equal to
the textbox placed in the switchboard. How do I do that?
 
A

Arvin Meyer [MVP]

Try:

Forms!FormName!SubformControlName.Form!Staff

substitute your names for:
FormName
and
SubformControlName

From the subform, the reference would be:

Me.Parent!Staff
 
K

Karafer via AccessMonster.com

Will it work for a subform that's in a subform that's in a form?
Try:

Forms!FormName!SubformControlName.Form!Staff

substitute your names for:
FormName
and
SubformControlName

From the subform, the reference would be:

Me.Parent!Staff
So I had this textbox named Staff on a subform placed in a form which is
in
[quoted text clipped - 5 lines]
to
the textbox placed in the switchboard. How do I do that?
 
A

Arvin Meyer [MVP]

You just have to go deeper. If working from within the deepest subform:

Me.Parent.Parent.Staff
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Karafer via AccessMonster.com said:
Will it work for a subform that's in a subform that's in a form?
Try:

Forms!FormName!SubformControlName.Form!Staff

substitute your names for:
FormName
and
SubformControlName

From the subform, the reference would be:

Me.Parent!Staff
So I had this textbox named Staff on a subform placed in a form which is
in
[quoted text clipped - 5 lines]
to
the textbox placed in the switchboard. How do I do that?
 
K

Karafer via AccessMonster.com

Arvin said:
You just have to go deeper. If working from within the deepest subform:

Me.Parent.Parent.Staff
Will it work for a subform that's in a subform that's in a form?
[quoted text clipped - 15 lines]

Got it!
 
Top