Results 1 to 10 of 10

Thread: Rounding

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Rounding

    I'm using access 97 and most of my number fields are for Italian Lira such as 55,456,789 I would like to round up to 55,457 but have had no luck yet, any help would be much appreciatd thanks in advance
    braddy60
    If you are a fool at forty, you will always be a fool

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding

    Try

    (Lira+500)1000

    Note that is the integer division operator (i.e. it does division and throws away the fractional part).

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Rounding

    Hi Douglas thanks for your quick response to my problem,If I tell you I am very new to access you will understand when I say I had difficulty in applying the format you posted for me because when I enter it Access puts in quote marks and turns it to text, sorry if I sound a bit stupid

    thanks again braddy60
    If you are a fool at forty, you will always be a fool

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Rounding

    Are you trying to populate a field or a variable? Are you working with values from a field or a variable? If you have a field called Lira, with a value of 55,456,789 and you want to assign the value rounded to the nearest 1000s to a variable, you would do it like this:

    <pre> Dim lngLira As Long
    lngLira = ([Lira]+500)1000</pre>


    The 500 you're adding to the value in [Lira] is to force a round up. Does that make it clearer?
    Charlotte

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding

    What Douglas gave you is not a format, it is a formula to calculate the rounded value. You can not use formats to round field values. The foumula could go in a number of places, depending on exactly how you want thing to work. It could go in the query or the beforeupdate event procedure when the value is put into the field in the table. It could go in the query that retrieves the value from the table, or it could go into code that puts the value into control on a form or report.
    Legare Coleman

  6. #6
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Rounding

    Thanks for your help
    You are on the right track to understand what I am trying to do but as yet I have had no succes, I tried to use the formula in query but I could not get it to work.

    Thanks braddy60
    If you are a fool at forty, you will always be a fool

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding

    This works for me:
    Attached Images Attached Images
    Legare Coleman

  8. #8
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Rounding

    Hi Legare thanks for trying to help me with my problem, as a layman I probably misled you
    I have attached a Jpeg the field I'm trying to formulate the field in question is marked in red
    and the formula that creates this field is =[Embedded43].[Form]![lira net price]

    Thanks again
    Attached Images Attached Images
    If you are a fool at forty, you will always be a fool

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rounding

    Try changing that to:

    <pre>=([Embedded43].[Form]![lira net price]+500)1000
    </pre>

    Legare Coleman

  10. #10
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Rounding

    Hi Legare

    You're a genius, it worked fine thank's a lot

    braddy60
    If you are a fool at forty, you will always be a fool

Posting Permissions

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