Sub-Form control data population

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a control on a sub-sub-form which sits on a sub-form. I would like to
automatically populate the control on sub-sub-Form with data from a control
on the sub-Form. How can this be done? Here is the current line of code
which should be doing it, however, it does not work. Can any one who knows
correct the line of code if it needs correcting and suggest the "Sub Event"
(control or form) under which it should be placed. Here is the line of code:

Private Sub txt_Full_Bottled_Product_BeforeUpdate(Cancel As Integer)

Forms![frm_Product_BourbInfoData_Collection]![frm_Customer_OpenBtl_DataRecs_fSub].Form![txt_Tare_Wt]
= Forms![frm_Product_BourbInfoData_Collection]![txt_Tare_Wt]

End Sub

Maybe, there is a better way of getting this done, if there is, please chime
in.

Thanks guys,
 
Jay said:
I have a control on a sub-sub-form which sits on a sub-form. I would like to
automatically populate the control on sub-sub-Form with data from a control
on the sub-Form. How can this be done? Here is the current line of code
which should be doing it, however, it does not work. Can any one who knows
correct the line of code if it needs correcting and suggest the "Sub Event"
(control or form) under which it should be placed. Here is the line of code:

Private Sub txt_Full_Bottled_Product_BeforeUpdate(Cancel As Integer)

Forms![frm_Product_BourbInfoData_Collection]![frm_Customer_OpenBtl_DataRecs_fSub].Form![txt_Tare_Wt]
= Forms![frm_Product_BourbInfoData_Collection]![txt_Tare_Wt]
End Sub


You should use the Form property for both levels of subform
controls.

If possible, the subsubform text box should use an
expression to display the value:
=Forms![frm_Product_BourbInfoData_Collection].FORM![frm_Customer_OpenBtl_DataRecs_fSub].Form![txt_Tare_Wt]

If that's not viable in your situation, try using the
AfterUpdate event instead of the BeforeUpdate.
 
Back
Top