Calculation from Subform

sned

New member
Local time
Today, 22:45
Joined
Aug 14, 2001
Messages
8
I have a subform which contains the price and quantity of items required. In the main from I have a field called total cost. I'd like the total cost field to calculate for all of the items in the subform.
(It's probably blindingly simple but there we go.)
 
In your subform, create a text field (if you have not already done so) to calculate the quantity x unit price. Call this field ExtendedPrice. In the footer of your subform, create a text field and in the control source put =Sum([ExtendedPrice]). Name this field OrderSubtotal. You can choose to leave this field visible set to no.
I am assuming that your sub form is set to datasheet view.

In your main form create another text field and place the following in the control source:

=[SubformName].Form![OrderSubtotal]

Replace "SubformName" with the actual name of your subform.

[This message has been edited by Carol (edited 08-14-2001).]

[This message has been edited by Carol (edited 08-14-2001).]
 
I'm having a similar problem--trying to create calculated fields on a subform. My counts & sums all return #Error (and yes, they're located on the Form Footer). I'm doing a couple of things differently, though.
  1. I'm using a Countinous Form view for my subform (allowed for easier & tighter organization, plus better control over colors, column headers, etc).
  2. I'm performing the sums on calculated fields created in the underlying query, ie, linetotal: [qty]*[price]. The Count field is not based on a calculated field, though, and it also returns #Error
    [/list=a]
    I've tried using datasheet view instead, same problem. I've also tried performing the line calculations on the form instead of the underlying query, again, same #Error. I've checked it all out, there's no mistake in the Control Source, no circular references.

    The pathetic thing is that I've done this a hundred times, but I can't seem to see the problem.

    (edited for clarity)

    [This message has been edited by Jonathan Kok (edited 08-15-2001).]
 
Usually receiving the "Error" message means that you have a naming problem. When you are using fields for count and sums, make sure that you are referring to the correct field Name, and not the fields Controlsource.
 

Users who are viewing this thread

Back
Top Bottom