Query to sum debits and credits

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.
 
J

John Spencer

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
..
 

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