View Full Version : Function question


LAN
10-19-2001, 08:02 AM
The following sql statment is in dba that I have inherited to clean up and improve functionality. I cannot find any reference the "round" function. When I recreate this in separate dba it will not work but is working in this dba? Help
UPDATE TRADE SET TRADE.TRD_CUTS = round([trd_cash]/[trd_cpri],3)
WHERE (((TRADE.TRD_ACT)="B") AND ((TRADE.TRD_CERT)="D")) OR (((TRADE.TRD_ACT)="S") AND ((TRADE.TRD_CERT)="D"));

R. Hicks
10-19-2001, 02:32 PM
Try adding the function below to a new module:

Public Function round(digit As Double, rdigit As Integer) As Double
Dim x As Double
x = 10 ^ rdigit
round = Int(digit * x + 0.5) / x
End Function

HTH
RDH

[This message has been edited by R. Hicks (edited 10-19-2001).]