Results 1 to 10 of 10

Thread: decimals

  1. #1
    Join Date
    Sep 2003
    Posts
    8

    Unanswered: decimals

    I have a text box in the footer of a subform. This textbox performs a calculation. It sums all the data, then divides the sum by 40, then divides that number by 4.33. I copied this text box onto my main form.

    I cannot figure out how to get the resulting number to have just one digit to the right of the decimal point. I have tried changing the decimal properties from auto to 1, but nothing happens.

    Please help.
    Thanks.

  2. #2
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150
    Try rounding your calculation

    i.e.

    the textbox source will look something like this

    =Round(Your Calculation here, 1)

    This will round the value to 1 decimal point
    JJ Kennedy
    Double J IT Solutions
    www.doublejit.co.nz

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

  3. #3
    Join Date
    Sep 2003
    Posts
    8
    What exactly is my syntax? I am not real familiar with the code.

    My formula is =Sum([Hours]/40/4.33)

    What brackets do I use around my entire calculation? How exactly should it look?

    Thanks for your help guru...




    Originally posted by machado
    Try rounding your calculation

    i.e.

    the textbox source will look something like this

    =Round(Your Calculation here, 1)

    This will round the value to 1 decimal point

  4. #4
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150
    It should look something like this

    =Round(Sum([Hours]/40/4.33), 1)
    JJ Kennedy
    Double J IT Solutions
    www.doublejit.co.nz

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

  5. #5
    Join Date
    Sep 2003
    Posts
    8
    That did not work. Also, in your posting, the [/SIZE][/QUOTE] does not show up, but I see it now when I am trying to reply???

    I tried that too, and it still doesn't work. I get an error message #Name?

    Who would have thought something so simple could be so difficult. Thanks for any additional input you can provide.



    Originally posted by machado
    It should look something like this

    =Round(Sum([Hours]/40/4.33), 1)

  6. #6
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150
    The #Name error refers to [Hours] in the formula. Make sure that the Field [Hours] exist in the Recordsource of this form.

    Also Make sure that the equals sign is before the formula.
    JJ Kennedy
    Double J IT Solutions
    www.doublejit.co.nz

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

  7. #7
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198
    Try =Format(Sum([Hours]/40/4.33),"0.00")

    And rename the textbox in the footer as somehting like Sum_Hours

    The [/SIZE][/QUOTE] is part of the vb code and is explained here http://www.dbforums.com/misc.php?action=bbcode
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

  8. #8
    Join Date
    Sep 2003
    Posts
    8
    THAT WORKED!! But it generated another issue. Now the result is left aligned instead of right aligned as it was when it had 5 numbers after the decimal. Any suggestions?

    Thanks so much for your time. This is the last little thing I need to have one great looking form!

    Originally posted by jimpen
    Try =Format(Sum([Hours]/40/4.33),"0.00")

    And rename the textbox in the footer as somehting like Sum_Hours

    The
    is part of the vb code and is explained here http://www.dbforums.com/misc.php?action=bbcode [/SIZE][/QUOTE]

  9. #9
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198
    Just select the text box in form design and hit the Align Right button on the toolbar.
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

  10. #10
    Join Date
    Sep 2003
    Posts
    8
    Thanks. I have spent so much time on this one issue, I missed the obvious at the end. Everything works great now.

    Thanks for all your help!!




    Originally posted by jimpen
    Just select the text box in form design and hit the Align Right button on the toolbar.

Posting Permissions

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