Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2007
    Posts
    214

    Exclamation Unanswered: Unwanted Negative Sign In SUM

    Oh my access report, I am trying to SUM the totals in a text box. For instance, the formula I am using looks like this: =Sum([combo53]="300")

    Obviously I want them sum of all combo boxes that read the code 300.

    Well when I run the report, it displays the correct number, however it displays a negative sign next to the number. Why? Can I get rid of this negative sign? It confuses my clients when they view the reports.

    Thanks!

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You can use the Abs() function.
    Paul

  3. #3
    Join Date
    Oct 2007
    Posts
    214
    Not quite sure how to use that...

    =Sum([combo53]="300") is what the text box on my report reads. As I mentioned when I actually run the report (put in the date ranges and client name) the number displays but in a negative....

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Did you look in Help at the Abs function? It should show you how to use it.
    Paul

  5. #5
    Join Date
    Oct 2007
    Posts
    214

    Exclamation

    Yeah I did but sadly it doesn't give me a great example...it looks like the example they are giving me is something you enter in the event procedure of the form. I'm not sure how that would work. I really don't understand why the SUM function is displaying a negative sign anyway. Thanks for the help.

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by benz1984
    Yeah I did but sadly it doesn't give me a great example...it looks like the example they are giving me is something you enter in the event procedure of the form. I'm not sure how that would work. I really don't understand why the SUM function is displaying a negative sign anyway. Thanks for the help.
    have you checked your data?
    On the face of it assigning a value to a control of the sum of a combo box seems odd. I don't understand the thinking
    do you mean the sum of all the values int he combo box?

    if so then Im not certain sum is the right approach.
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    It's summing a boolean value, hence the negative:

    =Abs(Sum([combo53]="300"))
    Paul

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Another alternative:
    Code:
    Sum(Iif([combo53]="300",300,0))
    Also, change your combobox name to be something more descripptive - it'll help you in the future! Also, the value "300" surrounded by quotes suggests that it is in fact a text value; which you cannot sum!

    If you want to perform any form of calculation on a numebr, then store it as a number
    George
    Home | Blog

  9. #9
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    George, I think that would be:

    Sum(Iif([combo53]="300",1,0))

    as you want to count 1 for each value, not 300.
    Paul

  10. #10
    Join Date
    Oct 2007
    Posts
    214
    Thanks everyone this worked great!!!!!

  11. #11
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by benz1984
    Oh my access report, I am trying to SUM the totals in a text box. For instance, the formula I am using looks like this: =Sum([combo53]="300")

    Obviously I want them sum of all combo boxes that read the code 300.
    Quote Originally Posted by pbaldy
    George, I think that would be:

    Sum(Iif([combo53]="300",1,0))

    as you want to count 1 for each value, not 300.
    That would be a count of the number of textboxes containing that value, I was summing the values within instead. Either way Ben got his answer, so all is well and good in the Access garden.
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •