Wrong in what (specific) way? Result is a value of zero? A NULL value? A
>I have created a TQuery, SQLSumStockAmt, like this
>Select Sum( Price * Qty) TotAmt
> From "stock.db" stock
>Where PurId = :Pur_Id
>Then in the Data Module, I assign the value to the parameter and open
> SQLSumStockAmt.Params.AsInteger := PurchasePurId.Value;
>But when I ShowMessage(IntToStr(Round(SQLSumStockAmtTotAmt.Value)));
>The value is wrong!
nonzero value, but apparently from the wrong records?
Do you have the TQuery.DataSource property set to anything? Should not be,
unless this is the Detail table of a Master-Detail relationship.
Try using the same SQL statement, but viewing it in a visual data-aware
control. Is the result what you would expect?
Try expanding the SQL statement to include the PurID column in the SELECT
clause. (This also requires adding a GROUP BY, but just for this test
statement.) Is the value returned in the PurID column the expected one?
SELECT SUM(Price * Qty) AS TotAmt
WHERE PurId = :Pur_Id
What is the result of using the value of the AsString property when
displaying the result set value with ShowMessage?
Steve Koterski "Television is a medium because anything well done
Felton, CA is rare."
-- Fred Allen (1894-1956)