Link to home
Start Free TrialLog in
Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScFlag for Zambia

asked on

How format function to round off figures

Hi

Is there a way to round off figures in ms access with the format function , for example

9.333 X 15.1111  =  141.0318963  now if I round off on the format property of a form to 2 decimal places  it gives me 141.03 , my control on the other subform require the users to balance off with this 141.0318963, if it does not balance off then the data on the form cannot be saved.

Because of the decimals remaining the data cannot be saved , then how do I format both controls so that if the users captures 141.03  not 141.0318963 the data can be saved

Regards

Chris
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

use the Round
Round(Amount,NoOfDecimals)

Open in new window

e.g.
amountToPay=Round(141.0318963,2)-->141.03

Open in new window

Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc

ASKER

Now if the round off number amountToPay=Round(141.0318963,2)-->141.03  if I subtract with  141.03 are you sure it wont leave some points?????


Regards

Chris
Maybe I'm not clear here , what I want is that if the difference is between -0.5 and 0.50 then let the data maybe saved

If diff.txt ( between -1And 1) Then
MsgBox " Please clear the difference"
Cancel = True
Exit Sub
End If
End Sub

Now I'm not sure how the above can be polished up to work, please check.

Regards

Chris
Use the Format property on both numbers in the comparison?
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial