Rounding in MS Access

后端 未结 12 706
夕颜
夕颜 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条回答
  •  旧时难觅i
    2020-11-28 15:08

    Here is easy way to always round up to next whole number in Access 2003:

    BillWt = IIf([Weight]-Int([Weight])=0,[Weight],Int([Weight])+1)
    

    For example:

    • [Weight] = 5.33 ; Int([Weight]) = 5 ; so 5.33-5 = 0.33 (<>0), so answer is BillWt = 5+1 = 6.
    • [Weight] = 6.000, Int([Weight]) = 6 , so 6.000-6 = 0, so answer is BillWt = 6.

提交回复
热议问题