Welcome to SPN

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

Sign Up Now!

I Need To Build An Expression In Access 2000 Which Rounds Up

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

  1. Danita

    Danita
    Expand Collapse
    Guest

    I am building text boxes in a form which reference other fields and I need
    the text boxes to roundup to the nearest dollar.
     
  2. Loading...


  3. OP
    Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    You can use the round function

    =Round([FieldName])

    To always round down
    =Int([FieldName])

    To always round up
    =Int([FieldName]) + 1

    --
    Good Luck
    BS"D


    "Danita" wrote:

    > I am building text boxes in a form which reference other fields and I need
    > the text boxes to roundup to the nearest dollar.
     
  4. OP
    Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    Sorry Danita
    Don't use the last example of rounding always up, I didn't consider a full
    number, that will take it up by 1

    --
    Good Luck
    BS"D


    "Danita" wrote:

    > I am building text boxes in a form which reference other fields and I need
    > the text boxes to roundup to the nearest dollar.
     
  5. OP
    Danita

    Danita
    Expand Collapse
    Guest

    Okay let me type an example:

    This is what my original field looks like:
    =[Standard]*.6

    =Round([Standard]*.06)
    Does that look right??

    "Ofer Cohen" wrote:

    > Sorry Danita
    > Don't use the last example of rounding always up, I didn't consider a full
    > number, that will take it up by 1
    >
    > --
    > Good Luck
    > BS"D
    >
    >
    > "Danita" wrote:
    >
    > > I am building text boxes in a form which reference other fields and I need
    > > the text boxes to roundup to the nearest dollar.
     
  6. OP
    Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    If that the original

    =[Standard]*.6

    Then use
    =Round([Standard]*.6)

    --
    Good Luck
    BS"D


    "Danita" wrote:

    > Okay let me type an example:
    >
    > This is what my original field looks like:
    > =[Standard]*.6
    >
    > =Round([Standard]*.06)
    > Does that look right??
    >
    > "Ofer Cohen" wrote:
    >
    > > Sorry Danita
    > > Don't use the last example of rounding always up, I didn't consider a full
    > > number, that will take it up by 1
    > >
    > > --
    > > Good Luck
    > > BS"D
    > >
    > >
    > > "Danita" wrote:
    > >
    > > > I am building text boxes in a form which reference other fields and I need
    > > > the text boxes to roundup to the nearest dollar.
     
  7. OP
    Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    +0.9999999999
    would not

    Pieter

    "Ofer Cohen" <OferCohen@discussions.microsoft.com> wrote in message
    news:85D8A3E4-2CC8-40D9-AB5B-CCBE75469D81@microsoft.com...
    > Sorry Danita
    > Don't use the last example of rounding always up, I didn't consider a full
    > number, that will take it up by 1
    >
    > --
    > Good Luck
    > BS"D
    >
    >
    > "Danita" wrote:
    >
    >> I am building text boxes in a form which reference other fields and I
    >> need
    >> the text boxes to roundup to the nearest dollar.
     
  8. OP
    Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    Sample for you:

    Public Function testround(var As Variant) As Long

    Dim d As Double

    If IsNull(var) = True Then
    testround = var
    Exit Function
    End If
    testround = Int(CDbl(var) + 0.5)

    End Function

    It's converting the received value explicitly to a double (getting in the
    habit for .NET conversion), adds 1/2, then takes the integer portion of the
    result.
     
Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     


Share This Page