Subform total is not working on Main form

Sunnylei

Registered User.
Local time
Today, 11:35
Joined
Mar 5, 2011
Messages
87
Hi
I created a subform which contains a total field for cost of each item. The total
Code:
= [Quantity]*[UnitPrice]*(1-[Discount]/100)
. The subform name is subfPurchaseOrders
I also created unbound Total cost which Sum up all items cost at subform footer
Code:
 Total Cost = Sum([Total])

I'm trying to display it on Main Form. I created one more unbound Total Cost in Main Form

Code:
 [subfPurchaseOrder].[Form]![TotalCost]

But it does not display anything on Main Form.
Can anyone help? :confused:
 
Hi

It is not possible sum fields disconnected from the query/table.

Try this:

Total Cost = Sum([Quantity]*[UnitPrice]*(1-[Discount]/100))


Success!
 
You cannot use an Aggregate Function, such as Sum() against a Calculated Field.

If, for instance, you have

FieldC = FieldA * FieldB

you cannot use

Sum(FieldC)

you have to use

Sum(FieldA * FieldB)

Also note that you have to be using the Field names here, not the name of the Controls on the Form that displays the Fields. Sometimes the two have identical names (that's how it's assigned them if you leave it to the Access Gnomes) and sometimes they're not.

Linq ;0)>
 
Hi

It is not possible sum fields disconnected from the query/table.

Try this:

Total Cost = Sum([Quantity]*[UnitPrice]*(1-[Discount]/100))


Success!

It's down. Thanks:)
 

Users who are viewing this thread

Back
Top Bottom