When calculating time sheets/rates sum i get a rounding up value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brittany1
    New Member
    • Jun 2010
    • 8

    When calculating time sheets/rates sum i get a rounding up value

    Please help i am geting a rounding up error when trying to multiply one calculated field by another.

    Total Time
    =Sum(([Time out]-[time in])*24)
    Value = 24.34

    Calculated Rates
    =([price_material]*[quantity])/[Total Time]
    Value = €10.68

    Calculate Total
    =[Calculated Rate]*[Total Time]
    Value = €260.00 This should be €259.95
    Last edited by NeoPa; Oct 21 '10, 04:45 PM. Reason: Please use the [code] tags provided.
  • dsatino
    Contributor
    • May 2010
    • 393

    #2
    Looks like the property of your total is set to "integer". Change it to "double" and recalculate.

    Comment

    • brittany1
      New Member
      • Jun 2010
      • 8

      #3
      Thanks for yout prompt reply
      i tried the following.
      =Format((CDbl([calculated rate]*[Total Time])),"#,##0.00 ")

      sorrry but i am stoll getting €260.00
      Last edited by NeoPa; Oct 21 '10, 04:46 PM. Reason: Please use the [code] tags provided.

      Comment

      • dsatino
        Contributor
        • May 2010
        • 393

        #4
        =Format((CDbl([calculated rate]*[Total Time])),"#,##0.00 ")

        Is this in the control source of a form, in a query, in code?

        What is Cdbl?
        Last edited by NeoPa; Oct 21 '10, 04:46 PM. Reason: Please use the [code] tags provided.

        Comment

        • brittany1
          New Member
          • Jun 2010
          • 8

          #5
          the code is in a field in a form
          upps! i was trying to format the firld for double
          i take it i got this wrong.

          Comment

          • dsatino
            Contributor
            • May 2010
            • 393

            #6
            =[calculated rate]*[Total Time]

            This is all you should need if the property of the field that it's in is set to 'double'.
            Last edited by NeoPa; Oct 21 '10, 04:47 PM. Reason: Please use the [code] tags provided.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32633

              #7
              It looks like you have a field somewhere defined as an integer of some sort. Field Data Types are not so trivial they can simply be left to default. Double (Which is Data Type of Number and Field Size of Double) is not the best approach to use in your case I would suggest. It will be closer certainly, but explore the Data Type of Currency if you want the currency values to be stored absolutely correctly.

              In its simplest form, your problem is related to not considering this issue at the design stage of your database. It's your choice what you actually use, but you should at least give the matter consideration.

              Comment

              • brittany1
                New Member
                • Jun 2010
                • 8

                #8
                Thanks for taking the time out to look at my project
                it would appear to have the correct field properties
                but i still cant stop the number from rounding up.
                Is it possible to set the property of a calculated
                (no table data source) field in a form to double?

                Time out = Date/Time
                Time in = Date/Time
                Material = Currency
                Rate = Currency
                Quantity = Number "Double"

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32633

                  #9
                  I don't believe so Brittany. I think Access determines the type of field based on the calculations and which field types are used within the calculation. I can't see why your value would round to an integer value with the types you've just provided. Nothing there is integral, so there'd be no reason for it to.

                  Comment

                  Working...