P. Scaram,
Thanks for the further explanation.
I'm sorry, I can see no reason for the error. You should be able to do
what you are doing. As far as I can see, the problem is not related to
the query, and the degree of complexity of the query is not relevant.
Although it does seem strange to have a field in the query with an alias
(CostOrder) the same as the name of the field it refers to. If you open
the datasheet of the query, does it display all records correctly, as
expected? And the same on the form? No blanks? Regarding: "the #name?
appears after the form has scrolled down through all the data", what is
shown in the totals textboxes prior to the #Name? coming up? Also, can
you let me know the names of the textboxes that the Sum expressions are
in? And the names of the textboxes in the detail of the form which show
the CostOrder and CustCostShare? I feel the problem is more likely to
be related to the form design than to the data.
--
Steve Schapel, Microsoft Access MVP
P. Scaram said:
Thank you for your help.
The sql query is
SELECT Cust_Order_Dtl.COrderNo, Prov_Order_Dtl.POrderNo,
Sum(Prov_Order_Dtl.PLinePrice) AS sumpercorder, CostProvSum.SumPLinePrice,
CostProvSum.Currency, CostProvSum.PExchangeRate, ProvOrderCost.CostOrder AS
CostOrder, (Sum([PLinePrice])/[SumPLinePrice])*[CostOrder] AS CustCostShare
FROM ((Prov_Order_Dtl INNER JOIN CostProvSum ON Prov_Order_Dtl.POrderNo =
CostProvSum.POrderNo) LEFT JOIN ProvOrderCost ON CostProvSum.POrderNo =
ProvOrderCost.POrderNo) INNER JOIN Cust_Order_Dtl ON (Prov_Order_Dtl.POrderNo
= Cust_Order_Dtl.POrderNo) AND (Prov_Order_Dtl.POrderLineNo =
Cust_Order_Dtl.POrderLineNo)
GROUP BY Cust_Order_Dtl.COrderNo, Prov_Order_Dtl.POrderNo,
CostProvSum.SumPLinePrice, CostProvSum.Currency, CostProvSum.PExchangeRate,
ProvOrderCost.CostOrder;
The fields we want to do a sum on are the CostOrder and the CustCostShare.
They are both defined with aliases. Also the #name? appears after the form
has scrolled down through all the data. If you make a spelling mistake i
noticed it appears immediately on the form.
Please notice that the query has a left join.
On the form the fields are CostOrder and CustCostShare.
In the form footer in the control source they are defined as =
Sum([CostOrder]),
=Sum([CustCostShare]).
Also the "Table" CostProvSum is a sum group query on a detail table.
Thank you in advance,
P. Scaram