Number precision

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jkwok
    New Member
    • Feb 2008
    • 32

    Number precision

    Hi,

    I have a make-table query with one attribute that is derrived from multiplying a number against currency value.

    For example:

    Hours Worked * Rate = Expense

    95.516 * $55.54 = 5305.0446044

    How can I control the decimal places so that I end up with this?

    95.516 * $55.54 = $5305.04

    I've tried editing the field properties in the query design window to change the result to currency but that didn't work. Should I have an input mask?

    Thanks,
    Jason
  • Zwoker
    New Member
    • Jul 2007
    • 66

    #2
    Originally posted by jkwok
    Hi,

    I have a make-table query with one attribute that is derrived from multiplying a number against currency value.

    For example:

    Hours Worked * Rate = Expense

    95.516 * $55.54 = 5305.0446044

    How can I control the decimal places so that I end up with this?

    95.516 * $55.54 = $5305.04

    I've tried editing the field properties in the query design window to change the result to currency but that didn't work. Should I have an input mask?

    Thanks,
    Jason
    I see two obvious possibilities - Someone who knows more than me can probably suggest more (or better ones) *grin*:

    1) Control the result at calculation time with a round statement. E.g. Expense = Round(Hours Worked * Rate, 2). This would store the result with 2 decimals.

    2) Keep the data stored with more precision, but display the result formatted. E.g. <Output> = Format(Expenses , "0.00")

    Both examples above are more pseudo-code than real VBA - You should check the help in your version of MS Access to see the options and true syntax.

    Comment

    • jkwok
      New Member
      • Feb 2008
      • 32

      #3
      These both sound like good solutions, I'll give them a try. Thanks!

      Comment

      Working...