access 2003 - calculating a grandtotal of a subform

M

mariee4

I have a subform which holds prices and i would like a grand total of these
prices in the "form" which contains the subform but all i seem to get is an
error. Not sure if i have made sense but fingers crossed! thanks
 
D

Damian S

Hi Mariee,

Try something like this:

=dsum("nz([FIELDTOSUM], 0)", "TABLENAME_OF_SUBFORM_DATA", "[MAINFORMIDNAME]
= " & me.MAINFORMID)

Hope this helps.

Damian.
 
M

mariee4

Thanks for trying but that didn’t work, let me try and explain my situation
better. My subform (fmOrdersDetails) consists of a field that calculates a
subtotal, it multiplies the [unitPrice] by the [quantity] and comes out with
a price for that item [subtotal], so I want it on the main form (fmOrders) to
calculate the total for that order which would be the total of all the
subtotals for that order.

Thank you sooo much in advance! - i'm close to kicking my computer to China!!


Damian S said:
Hi Mariee,

Try something like this:

=dsum("nz([FIELDTOSUM], 0)", "TABLENAME_OF_SUBFORM_DATA", "[MAINFORMIDNAME]
= " & me.MAINFORMID)

Hope this helps.

Damian.

mariee4 said:
I have a subform which holds prices and i would like a grand total of these
prices in the "form" which contains the subform but all i seem to get is an
error. Not sure if i have made sense but fingers crossed! thanks
 
M

mariee4

Thanks for trying but that didn’t work, let me try and explain my situation
better. My subform (fmOrdersDetails) consists of a field that calculates a
subtotal, it multiplies the [unitPrice] by the [quantity] and comes out with
a price for that item [subtotal], so I want it on the main form (fmOrders) to
calculate the total for that order which would be the total of all the
subtotals for that order.

Thank you sooo much!


Damian S said:
Hi Mariee,

Try something like this:

=dsum("nz([FIELDTOSUM], 0)", "TABLENAME_OF_SUBFORM_DATA", "[MAINFORMIDNAME]
= " & me.MAINFORMID)

Hope this helps.

Damian.

mariee4 said:
I have a subform which holds prices and i would like a grand total of these
prices in the "form" which contains the subform but all i seem to get is an
error. Not sure if i have made sense but fingers crossed! thanks
 
H

hdfixitup

Add a new text field to your subform; Give it a Name - "Total" no quotes;
then type in the control source row

=Sum([Name of Subtotal field])

Then, on your Form, add a text field and type in the control source row

=Forms![Name of Form]![Name of Subform]![Total]

mariee4 said:
Thanks for trying but that didn’t work, let me try and explain my situation
better. My subform (fmOrdersDetails) consists of a field that calculates a
subtotal, it multiplies the [unitPrice] by the [quantity] and comes out with
a price for that item [subtotal], so I want it on the main form (fmOrders) to
calculate the total for that order which would be the total of all the
subtotals for that order.

Thank you sooo much!


Damian S said:
Hi Mariee,

Try something like this:

=dsum("nz([FIELDTOSUM], 0)", "TABLENAME_OF_SUBFORM_DATA", "[MAINFORMIDNAME]
= " & me.MAINFORMID)

Hope this helps.

Damian.

mariee4 said:
I have a subform which holds prices and i would like a grand total of these
prices in the "form" which contains the subform but all i seem to get is an
error. Not sure if i have made sense but fingers crossed! thanks
 
J

John W. Vinson

Add a new text field to your subform; Give it a Name - "Total" no quotes;
then type in the control source row

=Sum([Name of Subtotal field])

Just an additional note: the Total textbox needs to be in the subform's Footer
or Header, not in the main part of the subform.

John W. Vinson [MVP]
 
Top