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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count of yes check box returns negative value 1

Status
Not open for further replies.

bdm1

Programmer
Feb 4, 2002
75
US
In a report I have an unbound text box which counts the number of check boxes checked "yes". The return value is a negative, -101. Although the 101 is correct, how can I get rid of the negative sign in front of the number. Thanks



"Total to be personalized:" & " " & Sum([Personalize])
 
This occurs because Yes/True values are stored in the table as -1 (and False/No values are 0). Your Sum() formula will total them up, internally using the formula 101 * -1 = -101, which gives your answer.

You can either use DCount ("fieldname", "Tablename", "fieldname=true")

or use the Abs mathematical function to return the absolute value of the total:

"Total to be personalized:" & " " & Abs (Sum([Personalize]))

John
 
Try the Abs function to return the absolute value:
Code:
=Abs(Sum([Personalize]))
 
Thanks much, I tried both these suggestions and voila..both work. I don't do this stuff much anymore and had forgotten about the DCount function...Thanks much
 
in SQL Count(??) Where (??) is True



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top