Query to sum debits and credits

  • Thread starter Thread starter allie357
  • Start date Start date
A

allie357

I need a query to sum to debits and credits based on a unique PO
Number. ( I also need to make other exclusions as you can see.)

Here is the query I have so far:

SELECT tblCommInfo.Commodity, tblCommInfo.[Commodity Type],
Sum(tblCommInfo.Amount) AS SumOfAmount, tblCommInfo.[PO Number]
FROM tblCommInfo
WHERE (((tblCommInfo.Amount)<5000) AND ((tblCommInfo.SubCode) Not Like
'64**' And (tblCommInfo.SubCode)<>"6506" And
(tblCommInfo.SubCode)<>"6513" And (tblCommInfo.SubCode)<>"6514" And
(tblCommInfo.SubCode)<>"6021") AND ((tblCommInfo.Purpose)<>"65811"))
GROUP BY tblCommInfo.Commodity, tblCommInfo.[Commodity Type],
tblCommInfo.[PO Number]
HAVING (((tblCommInfo.Commodity)="Computers"))
WITH OWNERACCESS OPTION;

Please help.
 
So is tblComm.Info.Amount the field that contains the debits and credits?
Or is there some other fields that do so.

If the credit and debit are stored in amount, how do you know which values
are credits and which values are debits?

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top