If I have "buy" and "sell" options within a field, how do I calcu.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field in a table which allows choice of "buy" or "sell" (investment
table). In the report, I have grouped the "same" stocks. How do I write a
formula to subtract the sells from the buys?
 
One way would be to base the report on a query similar to the following:

SELECT StockId, BuySell, Amount, IIf([Buysell]='Buy',[Amount],0) AS Bought,
IIf([buysell]='Sell',[Amount],0) AS Sold
FROM tblTransaction.

In the report summary band something like:

txtTotalAmount = sum(Amount)
txtTotalBought = sum(Bought)
txtTotalSold = sum(Sold)
txtDifference = sum(Bought) - sum(Sold)
or
txtDifference = txtTotalBought - txtTotalSold
 
Back
Top