If a control is bound to the desired field, do this:
Me!ControlName.Value = [Forms]![MainForm]![subform]![field].Value
If there is no control bound to the field, and the field is in the form's
recordsource, do this:
Me.[field].Value = [Forms]![MainForm]![subform]![field].Value
--
Ken Snell
<MS ACCESS MVP>
MT_dma said:
Thanks. I can get the value from the subform onto the main form. What I
want
to do is take the value calculated in the subform and have it added to the
underlying table. I've tried the following using the AfterUpdate for the
control:
Me!
.[field].Value = [Forms]![MainForm]![subform]![field].Value
Me!
.[Field].Value = Me! [Forms]![subform].[field].Value
I'm sure my code is totally messed up, but I know I've done this before.
I
just can't seem to remember how... very frusturating.
Thanks
Ken Snell said:
Not knowing what you've tried nor which "AfterUpdate" event you're using
(the form's? a control's?), here is how you generically get the value of
a
control in a subform when you are on the main form:
Me!NameOfControlOnMainForm.Value = _
Me.SubformName.Form.NameOfControlOnSubform.Value
or
Me!NameOfControlOnMainForm.Value = _
Me!SubformName!NameOfControlOnSubform.Value
where SubformName is the name of the subform control (the control that
actually holds the subform object).
--
Ken Snell
<MS ACCESS MVP>
I have a form with a linked subform that performs a calcluation. After
the
calculation is performed in the sub form I would like the value to be
added
to a field in a related table. I have tried various after update event
procedures trying to call the value of the sub form, but nothing seems
to
be
working. Any suggestions??
Thanks