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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uncontrolled rounding and decimal places

Status
Not open for further replies.

dunnjt

Technical User
Nov 20, 2001
64
US
dunnjt (TechnicalUser) Jul 29, 2004
For the last several weeks, this problem(rounding and too many decimal places) has taken a back seat to other items more pressing. However, now, I am still having the same problem with a rounding and decimal problem and am desperately looking for a solution.
Can anyone make a suggestion? I have attempted multiplying and dividing by 100 (thanks for the suggestion Bob S.) but that returns the same number unacceptable decimal places and rounding as the original extension number. Maybe this is really the answer but I am missing something in the process.
OPen to any suggestions.
Thank you - I hope there is a solution out there.
Jerry
 
can you describe your problem a little more?
maybe some sample code...

- RoppeTech
 
Hey RoppeTech - Thanks for responding. I had previously posted this question but still need a solution or some help applying the correct solution. The previous post is thread number 702-837544. The title is "Stop rounding, Please".
I don't write code but have been using Access since Access Verion 1.0 Do you think you or anyone could look at this past post and advise me how to fix this problem.

In a nutshell when Multipling the Unity price times the quantity everything is fine 'til I use a decimal in the Quantity field. The figure returned then shows three decimal places no matter what I try to force it to two decimal places. I also can not get it to stop rounding up. Example: [quantity]2.5*[unit price]1.57.59 =$393.975 When rounded, the final figure returned is $$393.98. I need the final figure to be 2 decimal places and no rounding like $393.97.
Thank you for any light you may shed on this.
Jerry
 
Have you tried something like this ?
(([quantity] * [unit price] * 1000)\10)/100

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How are ya dunnjt . . . . .

Below should work . . . . .

[blue]Int([quantity] * [unit price] * 100)/100[/blue]

Calvin.gif
See Ya! . . . . . .
 
This is a function I use all the time to round things to the nearest decimal place that I need. It rounds by a factor of 10. Place the code below in a module:
Code:
[COLOR=green]'Function to round a number to a factor (1,10,100,1000,etc..)[/color]
Function RoundCC(x, Factor)
    RoundCC = Int(x * Factor + 0.5) / Factor
End Function

Then you call it like so:

Code:
[COLOR=green]'Round 10.235[/color]
RoundCC(10.235, 100)

This would result in the function returning 10.24.

Hope that helps!

Joe Miller
joe.miller@flotech.net
 
Thanks to all those experts who contributed suggestions to solving my problem with uncontrolled rounding and decimal places. *100 and /100 and changing the figure to an integer was the key to solving this difficulty. This problem had been plagueging me "on and off" for a several weeks and am grateful for the help gotten from this forum.
Thanks again to all who helped.
Jerry D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top