If you notice in the footer of Orders Subform, there is a control named
OrderSubTotal with the control source of:
=Sum([ExtendedPrice])
That is what does the subtotaling; however, you don't see the footer of a
subform.
ExtendedPrice has a control source of ExtendedPrice which at first glance is
confusing, but if you look at the subform's record soucrce, the ExtendedPrice
is a calculated field:
ExtendedPrice: CCur([Order
Details].UnitPrice*[Quantity]*(1-[Discount])/100)*100
Where you see it is in the control on the main form named Subtotal. It has
the control source of:
=[Orders Subform].Form!OrderSubtotal
So that's how it works.
The extended price is calucluated in the record source for each row.
The subtotal for all rows is calculated using the Sum in the form footer of
the subform.
A visible control on the main form shows the current value of the hidden
control on the subform.
--
Dave Hargis, Microsoft Access MVP
Bob Love said:
I think i didn't answer your one question correctly. the subform uses the
query for the order details that match the order shown on the main form. the
query has the field Ext price:=[unit price]*[Qnty]. This Ext price field is
shown on the subform. I have a control in the main form labelled subtotal.
I want the subtotal control to show the sum of the extended price fields
from the sub form....I hope that is more clear.
--
Bob Love
:
What error did you get?
Is your calculated control in the subform's footer like it is in the Orders
subform?
BTW using a $ in a name is a very bad idea.
--
Dave Hargis, Microsoft Access MVP
:
I viewed the report of the north winds and the use the expression
=Nz(Sum(Extended Price),0)....I tried this substituting my field "Ext $" for
Extended price and it gave me an error. What about using a calculated
expression "=Sum([Forms]![Order Details Subform]![Ext $]) ..... should this
work
--
Bob Love
:
Check out the Orders form and the Orders Subform in the Northwind sample
database. It has a very good example of how that is done.
--
Dave Hargis, Microsoft Access MVP
:
This hopefully is a very simple answer but I just can't seem to get it. I
want to track my orders with my venders. I'm trying to use a Main Form/ Sub
form format. The main form has my vender and ordeer fields from that table
and my sub form shows the order details (I.E. Quantity, description, unit $.)
I use a query to find all details that match the order # in the main form.
I have a field on the query the uses the expression of Qnty * Unit $ to
calculate the extended $ but I can't seem to get the sum of the extended $
to the subtotal block on the main form. I know this should be simple but I
can't seem to figure it out. Thanks in advance for any and all help.