truncate function

truncate function

  • vb code

    Votes: 0 0.0%
  • Smilies

    Votes: 0 0.0%

  • Total voters
    0

yyyoong

New member
Local time
Today, 03:11
Joined
Aug 9, 2002
Messages
7
If i have a number and i try to use this expression to truncate the number (with 2 decimal places)in the query, but it doesn't work, can anyone please help me ?

TRUNC(number, 2)
 
Have you looked up the TRUNC function in Access Help? :rolleyes:

Is this a function you wrote? Should look like this:

Code:
Public Function TruncIt(Value, Optional Precision As Variant) As Double

    If IsNull(Value) Then Exit Function
    If IsMissing(Precision) Then Precision = 2
    Value = Fix(Value * 10 ^ Precision * Sgn(Value)) / 10 ^ Precision
    TruncIt= Value
    
End Function
 

Users who are viewing this thread

Back
Top Bottom