S
Scott
I have the following module and when I use it in a query,
Round([Quantity]*[UnitPrice]), it converts the data values to text. How do I
make it leave the data as currency or a number?
Option Explicit
Const Factor = 100
Function RoundC2(x)
'
' Rounds number to 2 decimal places
' Uses arithmatic rounding
' Designed for use with Currency values
'
If IsNull(x) Then
RoundC2 = Null
Else
RoundC2 = CCur(Int(x * Factor + 0.5) / Factor)
End If
End Function
Function Round(x)
Round = CCur(Int(x * Factor + 0.5) / Factor)
End Function
Function Round0(x)
Round0 = CCur(Int(x * 1 + 0.5) / 1)
End Function
Function TruncCC(x)
TruncCC = Int(x * 1) / 1
End Function
Thanks,
Scott
Round([Quantity]*[UnitPrice]), it converts the data values to text. How do I
make it leave the data as currency or a number?
Option Explicit
Const Factor = 100
Function RoundC2(x)
'
' Rounds number to 2 decimal places
' Uses arithmatic rounding
' Designed for use with Currency values
'
If IsNull(x) Then
RoundC2 = Null
Else
RoundC2 = CCur(Int(x * Factor + 0.5) / Factor)
End If
End Function
Function Round(x)
Round = CCur(Int(x * Factor + 0.5) / Factor)
End Function
Function Round0(x)
Round0 = CCur(Int(x * 1 + 0.5) / 1)
End Function
Function TruncCC(x)
TruncCC = Int(x * 1) / 1
End Function
Thanks,
Scott