Rounding in MS Access

后端 未结 12 648
夕颜
夕颜 2020-11-28 14:23

Whats the best way to round in VBA Access?

My current method utilizes the Excel method

Excel.WorksheetFunction.Round(...

But I am l

12条回答
  •  有刺的猬
    2020-11-28 15:08

    To expand a little on the accepted answer:

    "The Round function performs round to even, which is different from round to larger."
    --Microsoft

    Format always rounds up.

      Debug.Print Round(19.955, 2)
      'Answer: 19.95
    
      Debug.Print Format(19.955, "#.00")
      'Answer: 19.96
    

    ACC2000: Rounding Errors When You Use Floating-Point Numbers: http://support.microsoft.com/kb/210423

    ACC2000: How to Round a Number Up or Down by a Desired Increment: http://support.microsoft.com/kb/209996

    Round Function: http://msdn2.microsoft.com/en-us/library/se6f2zfx.aspx

    How To Implement Custom Rounding Procedures: http://support.microsoft.com/kb/196652

提交回复
热议问题