troubleshooting Question

Round off and Decimal places

Avatar of billcute
billcute asked on
Microsoft AccessMicrosoft Development
8 Comments1 Solution2278 ViewsLast Modified:
Users currently use the following code to compare two values ....

Private Sub txt_B_Exit(Cancel As Integer)
  Dim myLimit, myValue, myTol
  myLimit = 10
  myTol = 0.00005
  If Nz(Me.txt_B) < myLimit Then
    MsgBox "Sqarefeetvalues below " & myLimit & " are not possible in this context!", vbExclamation
    Cancel = True
    'Calculate formula
    myValue = (.............)
    myValue = Round(myValue, 5)

    ' Compare result with tolerance                                              '<<----- Critcal point
    If Abs(myValue - Me.txt_A.Value) > myTol Then
      MsgBox "The calculatd Value is " & myValue, vbCritical
      Me.Verified = True
    End If
  End If
End Sub
Our office usually round off to 5 decimal places all the time during data entry but adhere to the 3 decimal places when compiling a report. Most of the Engineers / Architects who request for permits from us usually round off to 3 decimal places when submiting their value of their new project "Flow" for us to validate.

Assuming that an Engineer submitted a flow of 0.006 but the auto calculated value
came out to be 0.00561.
In actual sense, the value of 0.006 submitted by the Engineer is correct if 0.00561 was
rounded off to 3 decimal places.
Using tolerance of value > 0.00005 through 0.00099 did not resolve the 3 decimal places
and as a result, the autocalculated value of 0.000561 did not accept the 0.00600 as correct or equals to 0.00561.
In this scenerio, in what way can I adjust the tolerance value to recond the following:
if the autocalculated value is 0.00561 then
(a). Accept the rounding off to 0.00600
(b) Deny rounding off to 0.00610
(c).Deny rounding off to 0.00500
(d). Accept rounding to 0.00560
(f). Deny rounding to 0.00562 since it was greater than the original    
     calculated value of 0.00561
Well, I am not too sure if the above is achievable, I was only pondering on it.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros