Problems moving results from Subform to Main Form

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

Guest

Ok so I have a subform that is tracking all of my purchases. In the header
of the subform, I have a subtotal result which works fine. When I try to
reference that value and actually display the subtotal on the main form
though, I get a #Name? error. The subtotal on the subform gets its result by:
=nz(Sum([linetotal])) and this works fine.
The reference on the main form to the sub form is:
=Forms!sfrmPurchaseDetail!OrderSubtotal

Any ideas? Thanks.

Troy W.
 
Ok so I have a subform that is tracking all of my purchases. In the header
of the subform, I have a subtotal result which works fine. When I try to
reference that value and actually display the subtotal on the main form
though, I get a #Name? error. The subtotal on the subform gets its result by:
=nz(Sum([linetotal])) and this works fine.
The reference on the main form to the sub form is:
=Forms!sfrmPurchaseDetail!OrderSubtotal

Referencing subforms is a bit peculiar. The subform is NOT part of the
Forms collection, and in fact the name of the form within the subform
control is not used.

Instead, you need the Name property *of the Subform control* - the box
containing the subform. This may or may not be the same as the name of
the form within that control. Set the control source to

=subPurchaseDetail.Form!OrderSubtotal

if the Subform control is named subPurchasedetail.

John W. Vinson[MVP]
 
John,
Thanks for your help. You were right, the form itself was named just a
little different. Once I fixed the name and then formated the reference like
you suggested, it worked perfectly.

Troy

John Vinson said:
Ok so I have a subform that is tracking all of my purchases. In the header
of the subform, I have a subtotal result which works fine. When I try to
reference that value and actually display the subtotal on the main form
though, I get a #Name? error. The subtotal on the subform gets its result by:
=nz(Sum([linetotal])) and this works fine.
The reference on the main form to the sub form is:
=Forms!sfrmPurchaseDetail!OrderSubtotal

Referencing subforms is a bit peculiar. The subform is NOT part of the
Forms collection, and in fact the name of the form within the subform
control is not used.

Instead, you need the Name property *of the Subform control* - the box
containing the subform. This may or may not be the same as the name of
the form within that control. Set the control source to

=subPurchaseDetail.Form!OrderSubtotal

if the Subform control is named subPurchasedetail.

John W. Vinson[MVP]
 
Back
Top