public function roundtolarger(dblinput as double, intdecimals as integer) as double
'implements a variant of the round() function, that rounds-to-larger
'rather than rounds-to-even:
dim strformatstring as string 'format string
'if input is zero, just return zero. else format as appropriate:
if dblinput <> 0 then
strformatstring = "#." & string(intdecimals, "#")
roundtolarger = format(dblinput, strformatstring)
else
roundtolarger = 0
end if
end function
=====================================
? round(2.385, 2)
2.38
? roundtolarger(2.385, 2)
2.39
转自: www.tek-tips.com/faqs.cfm?spid=705&rat1=10&sfid=3734
本站来源: ACCESS中国 zhuyiwen
Access软件网交流QQ群(群号:198465573) |