Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

save rounded value

Discussion in 'Information Technology' started by Johnie Karr, Jul 28, 2006.

  1. Johnie Karr

    Johnie Karr
    Expand Collapse
    Guest

    I have a surcharge field which automatically calculates 3 percent of the
    subtotal with the following calculation:

    Me!Surcharge = (Me!SubTotal * Me!surchargePercent) / 100

    This will give me a correct calculated answer.

    My problem is, it displays a rounded number but saves a not rounded number
    making for incorrect reports (the database is exported to a .dbf file for
    further processing).

    An example is:

    79.8394
    If that is the result of my calculation it will save as 79.8394, but will
    display 79.84.

    I have found, via searching this forum, that I can truncate the decimals to
    79.8394 and keep it as currency type and it will not round, and it will only
    save 79.83.

    My client needs it to round to 79.84 and save the data as 79.84.

    Thanks,
    Johnie Karr
    johnie@datamt.org
    Data Management Technologies
    www.datamt.org
     
  2. Loading...

    Similar Threads Forum Date
    Convinced By Sikh, Muslim Family Saves Hindu Lives Interfaith Dialogues Jun 24, 2016
    S Asia Sikhs want Nawaz Sharif to help save Pakistan Gurdwaras Breaking News Jan 23, 2014
    Save Your Sanity for Less (Financial Fix Video) Business, Lifestyle & Leisure Jan 15, 2014
    Sikhi is in Ruins. How Can We Save It? Sikh Sikhi Sikhism Jan 4, 2013
    Save the Historical Gurdwaras in Pakistan Sikh Gurdwaras Dec 21, 2012

  3. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Johnie

    Use the Round function:

    Me!Surcharge = Round((Me!SubTotal * Me!surchargePercent) / 100, 2)

    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Johnie Karr" <JohnieKarr@discussions.microsoft.com> wrote in message
    news:C9DA3143-3F8D-4AAB-8EE5-DC51982313C5@microsoft.com...
    >I have a surcharge field which automatically calculates 3 percent of the
    > subtotal with the following calculation:
    >
    > Me!Surcharge = (Me!SubTotal * Me!surchargePercent) / 100
    >
    > This will give me a correct calculated answer.
    >
    > My problem is, it displays a rounded number but saves a not rounded number
    > making for incorrect reports (the database is exported to a .dbf file for
    > further processing).
    >
    > An example is:
    >
    > 79.8394
    > If that is the result of my calculation it will save as 79.8394, but will
    > display 79.84.
    >
    > I have found, via searching this forum, that I can truncate the decimals
    > to
    > 79.8394 and keep it as currency type and it will not round, and it will
    > only
    > save 79.83.
    >
    > My client needs it to round to 79.84 and save the data as 79.84.
    >
    > Thanks,
    > Johnie Karr
    > johnie@datamt.org
    > Data Management Technologies
    > www.datamt.org
     
  4. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Tue, 20 Jun 2006 13:16:01 -0700, Johnie Karr
    <JohnieKarr@discussions.microsoft.com> wrote:

    >My client needs it to round to 79.84 and save the data as 79.84.


    Ok, so round it:

    Round(Me!Surcharge = (Me!SubTotal * Me!surchargePercent) / 100, 2)

    John W. Vinson[MVP]
     
  5. Johnie Karr

    Johnie Karr
    Expand Collapse
    Guest

    John and Graham,

    It worked!

    Thanks,
    Johnie Karr
    Data Management Technologies
    www.datamt.org

    "John Vinson" wrote:

    > On Tue, 20 Jun 2006 13:16:01 -0700, Johnie Karr
    > <JohnieKarr@discussions.microsoft.com> wrote:
    >
    > >My client needs it to round to 79.84 and save the data as 79.84.

    >
    > Ok, so round it:
    >
    > Round(Me!Surcharge = (Me!SubTotal * Me!surchargePercent) / 100, 2)
    >
    > John W. Vinson[MVP]
    >
     

Share This Page