Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Sums

Status
Not open for further replies.

ZeoGel

Technical User
May 13, 2003
28
US
I have 2 questions
1. I have a record with 3 choices on one column meaning you can choose a , b or c. Now i need to sum each one of the choices can someone help?

2. I have a check box and i want to sum up everytime it has been checked i keep coming up with a negative number how can i make it positive

Thank you
Ron
 
True in Access is -1. Probably need to strip off the sign before summing. One way is sum(ABS(yourcheckfield)) or any other way that removes the sign.


Use the ternary function iif to put a 1 or 0 depending on the value and sum all the 1's.

select sum(iif(fld='a',1,0) as choicesA, sum(iif(fld='b',1,0) as choicesB, sum(iif(fld='c',1,0) as choicesC
from yourtable.
 
Thank You Cmmrfrds It worked great :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top