Sum function not summing correctly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kbeana
    New Member
    • Oct 2007
    • 2

    Sum function not summing correctly

    I can't figure this out for the life of me. I have several fields that are set up as currency, and all have a decimal place of 2. I am summing some of them in the report footer, and it will be a couple cents off every time. The syntax I'm using is =Sum([FapAdj])

    I read another question similar to this one and the answer was that it was only rounding the display to 2 decimal places and not necessarily storing the data as 2 decimal places. How do I make sure that's not the case with my field as well? I checked the fields in both the table and in the form itself, and both have decimal places of 2.

    Another twist is that some of the fields are actual calculations themselves. I have an event where On Focus, it suggests an amount based on fields they've entered previously. The user can either tab through to accept this amount, or type over it to enter a new amount. I would guess that's where my fractions of cents are coming from?? But I can't figure it out. An example of this is:
    FapAdj = (([Total Charges] - [ThirdPartyPmt] - [PtPmt]) * [Percent]) / 100
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by kbeana
    I can't figure this out for the life of me. I have several fields that are set up as currency, and all have a decimal place of 2. I am summing some of them in the report footer, and it will be a couple cents off every time. The syntax I'm using is =Sum([FapAdj])

    I read another question similar to this one and the answer was that it was only rounding the display to 2 decimal places and not necessarily storing the data as 2 decimal places. How do I make sure that's not the case with my field as well? I checked the fields in both the table and in the form itself, and both have decimal places of 2.

    Another twist is that some of the fields are actual calculations themselves. I have an event where On Focus, it suggests an amount based on fields they've entered previously. The user can either tab through to accept this amount, or type over it to enter a new amount. I would guess that's where my fractions of cents are coming from?? But I can't figure it out. An example of this is:
    FapAdj = (([Total Charges] - [ThirdPartyPmt] - [PtPmt]) * [Percent]) / 100

    What datatypes are you using? Have a look at your selected datatype Fieldsize again in the table design try using the number datatype with a fieldsize of DOUBLE formatted as currency this gives you greater precision requires 8 bytes of storage space. You can set the decimal point to two places. See if this helps you

    Jim

    Comment

    • kbeana
      New Member
      • Oct 2007
      • 2

      #3
      Thanks for your help. I made the changes you suggested but it didn't change the total I was getting. Would that change the records all ready stored? Or will this only affect any new records added?

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by kbeana
        Thanks for your help. I made the changes you suggested but it didn't change the total I was getting. Would that change the records all ready stored? Or will this only affect any new records added?
        No it won't change the records stored. Whats stored is stored. New records will carry a double datatype precision. Look at datatypes in help to understand the fundamental differences. Also make sure any unbound form or report controls reflect your revamp too look again at them in design.

        Regards

        Jim

        Comment

        Working...