Hello again! I have the function below contained in a module in my database. It's purpose is to return a value rounded up to the nearest .25. It is currently returning #ERROR, and I am hoping some of you wiser than me might be able to offer me some suggestions as to the possible cause.
The field(s) being used for input on this are Numbers, field size double, format fixed. Any help you can offer here will be greatly appreciated.
Function RoundNearestQuarter(sNum)
Dim sDigit, iNum
sDigit = IIf(InStr(1, sNum, "."
> 0, CStr(Right(sNum, 2)), "0"
iNum = Int(sNum)
If sDigit >= "10" And sDigit <= "25" Then
sDigit = "25"
If sDigit >= "26" And sDigit <= "50" Then
sDigit = "50"
If sDigit >= "51" And sDigit <= "75" Then
sDigit = "75"
ElseIf sDigit >= "76" And sDigit <= "99" Then
sDigit = "00"
iNum = iNum + 1
End If
RoundNearestQuarter = iNum & "." & sDigit
End Function
The field(s) being used for input on this are Numbers, field size double, format fixed. Any help you can offer here will be greatly appreciated.
Function RoundNearestQuarter(sNum)
Dim sDigit, iNum
sDigit = IIf(InStr(1, sNum, "."
iNum = Int(sNum)
If sDigit >= "10" And sDigit <= "25" Then
sDigit = "25"
If sDigit >= "26" And sDigit <= "50" Then
sDigit = "50"
If sDigit >= "51" And sDigit <= "75" Then
sDigit = "75"
ElseIf sDigit >= "76" And sDigit <= "99" Then
sDigit = "00"
iNum = iNum + 1
End If
RoundNearestQuarter = iNum & "." & sDigit
End Function