Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    May 2002
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Rounding Results of Calculation (97/SR-2)

    How can I get Access to round the result of a calculation? I use a query to calculate a late payment fee as .000833 of an overdue balance. I need to have the result rounded to two decimal places -- not just displayed with two decimal places, but stored that way. Is there a function that does this? Is there ANYTHING that does this?

    Thanks for helping!

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    -------------------------------------------------
    --- not just displayed with two decimal places, but stored that way. Is there a function that does this? Is there ANYTHING that does this?
    ----------------------------------------------
    I think you will find the Currency data type will store the values correctly for you. You can set it in the design view of the table. Set the fields data type to

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    I just had a thought, what do Microsoft use to do their accounts? The currency type in Access wouldn

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    I use the following function to round to 2 decimal places.
    <pre>public function gfRound2(input) as currency

    gfRound2 = CCur(CCur(input)/100) * 100

    end function</pre>

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    I once heard of a presentation about a new Microsoft product performed by a Microsoft representative.
    It was performed using a Macintosh linked to the o/head display and documentation was provided by Adobe!

  6. #6
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    Setting the format to 2 decimal places doesn't have any effect on how it is stored - just how it is displayed.
    I once fell into that trap some time ago and had problems such as:-
    Why does 1.25 + 1.25 + 1.25 = 3.76!
    Setting the display to more decimal places showed it was in fact 1.253 + 1.253 + 1.253

    I would recommend NOT to use the formatting possibility in a table just to assist you, as developer/administrator, if you need to go into the tables to track a problem. You can always display it on form/report to 2 decimal places for the users.

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding Results of Calculation (97/SR-2)

    Well if I had unlimited resources I

Posting Permissions

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