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

L

luvaccess05

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?
 
B

Bill Edwards

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top