Link to home
Start Free TrialLog in
Avatar of João serras-pereira
João serras-pereiraFlag for Portugal

asked on

addressing a subform frim a subform inside it

I had this question after viewing how to address a subform in a form, from inside another subform.

Hi -

I have modified my code according  to the guideline. Now I am stuck on trying to address a field in a form from which I am a subform and, in turn, is a subform of a master form like this:

FORM A_master
   FORM A1_subForm
         field A1F1
   FORM A11_subform
      FIELD A11F1
         <<want to make A1F1 = A11F1>>

I am trying several syntaxes at no avail


I am sending  2 screenshots to show:

User generated imageUser generated image

any ideas?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try

FORM_A1_subForm.A1F1 = FORM_A11_subForm.A11F1

or

FORM_A1_subForm.A1F1.value = FORM_A11_subForm.A11F1.value
SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America 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
Depends on where the code is running.   Think of this as a tree just like you showed:

FORM A_master
   FORM A1_subForm
         field A1F1
   FORM A11_subform
      FIELD A11F1
         <<want to make A1F1 = A11F1>>


  So if the code is running in A1_SUBFORM, I have to move up the tree (Me.Parent) and then move down to the other subform (using the subform control name and FORM), so:

  Me.Parent.<subform control name>.FORM.[A1F1] = Me.A11F1

Jim.
Avatar of João serras-pereira

ASKER

the code is in A11_subform (the bottom down form) and needs to refere to A1_subform (one level up); it is required to  update the control A1F1

so, should it be the same? i.e. assuming that the controls are named after the forms

Me.Parent.CTL_A1F1.FORM.[A1F1] = Me.A11F1  ?
SOLUTION
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
ASKER CERTIFIED SOLUTION
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
so, should it be the same? i.e. assuming that the controls are named after the forms
Check the Name property of the subform container control.  If the name is different from the name of the subform object, then use the Name property.
Hi all. Really MANY THANKS for caring and helping me! You're really heavyweights and respond beyond any expectations! I am sorry to have ONLY 500 points. I am taking care off ALL comments, so really, many thanks.

Finally, I now know what I was getting really wrong (I was thinking upside down) and Jim's explanation got me right!
In the end I just needed to make Me.Parent.fld_A1 = fld_A11

I feel so stupid I can't believe myself

/joao