Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare 2 decimal Round only from 4 decimal 1

Status
Not open for further replies.

WordTechinc

Programmer
Sep 4, 2009
38
How to compre 2 decimal only?
AmountPD have 2 decimal (ex) 125.54
Discount have 4 decimal (ex) 125.5364

I want to compare AmountPD(125.54) = Discount (125.54).

Here is code;

If .Fields("AmountPD").Value <> .Fields("Discount").Value Then
.Fields("FaceLetter").Value = False
Else
.Fields("FaceLetter").Value = True
End If
 
If Round(.Fields("AmountPD"), 2) <> Round(.Fields("Discount"), 2) Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you. This worked great except the follwoing case;

AmountPD = 190.37
Discount = 190.365 - It didn't round as 190.37
 
If Round(.Fields("AmountPD"), 2) <> Round(.Fields("Discount") + 0.001, 2) Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top