Getting a subforms total into the main form

  • Thread starter Thread starter Steffen Johnson
  • Start date Start date
S

Steffen Johnson

I have a form called frmSales which has a sub form named
frmSalesDtls subform. The subform is made up of three
fields the price field, the quantity field and the
price_total field which is = price * qty. In the frmSales
form I want to display the total sum of the price_total
field. I've tried using the following formulas but I just
get error message:

=Sum([frmSalesDtls subform]![Form]!price_total)

=Sum([frmSalesDtls subform]![Form]!Price*[frmSalesDtls
subform]![Form]!Qty).

Can someone explain to me why this doesn't work ?

Steffen
 
Suggest that you build your reference with the expression builder. A full
reference includes ...![frmMain]![frmSub].[control].
 
The name of my main form is tblSales. The name of the
subform is tblSalesDtls subform. The name of the control
field is Total Price. So I tried...

=Sum([tblSales]![tblSalesDtls Subform].Form![Total Price])
then...
=Sum(Forms![tblSales]![tblSalesDtls Subform].Form![Total
Price])
and finally...
=Sum([tblSales]![tblSalesDtls Subform].[Total Price])


and still got an #Error msg when I ran them.

Any more suggestion?
 
You're pretty close. Try

=Sum([Forms]![tblSales]![tblSalesDtls Subform].[Total_Price])

Good idea not to have spaces in fieldnames, tho...
 
I'm getting tired. Your references can't be frmXxxx in one place and
tblXxxx in another place. You're not using the expression builder if this
is happening.
 
Back
Top