Wrox Programmer Forums round function help
 |
 Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

October 19th, 2004, 06:32 AM
 mohiddin52 Authorized User Join Date: Dec 2003 Posts: 63 Thanks: 0 Thanked 0 Times in 0 Posts
round function help

How to round a number which has no decimal.I want to round the number to the nearest zero.
That is,if the last digit of the number is 0,then it should be as it is.If the last digit
is 1,2,3 or 4,then the number should be rounded of to the previous zero.(Eg. 704 to 700)
If the number ends in 5,6,7,8, or 9 then it should be rounded of to the next zero (Eg. 706 to 710)
In Excel, it is working like this.ROUND(Number,-1).In Access Help Function says the same logic.
But,when executing the same formula,it displays Error message.

Mohamed Mohiddin
Officer
__________________
Mohamed Mohiddin
Officer

October 19th, 2004, 06:47 AM
 Ray Pinnegar Authorized User Join Date: Jul 2003 Posts: 73 Thanks: 0 Thanked 0 Times in 0 Posts

Divide by 10
Remove decimal part (use INT() )
Multiply by 10 again

Cheers Ray

October 21st, 2004, 07:14 AM
 mohiddin52 Authorized User Join Date: Dec 2003 Posts: 63 Thanks: 0 Thanked 0 Times in 0 Posts

Dear Ray,
Thanks for the help with which we were able to sort out the problem.
But there was a small problem in your reply.Integer function removes the
decimals alltogether.In the process,it removes the digits after the
decimal point which are 5 or above (ie, 5to 9).Then,we cannot get the
higher zero (ie, 709 also becomes 700 and not 710). So we have used
the Round function to solve the problem after dividing the number by 10
(ie,round(number,0).Then we have multiplied by 10 to get our result
correctly.We are still searching for the answer to solve the problem
by applting the Round(number,-1) function since it solves the problem straightaway
and since it works without any problem in Excel.Thanks once again for your
help.It has helped us to think in another way which we have nit thought
so far.

Mohamed Mohiddin
Officer

 Similar Threads Thread Thread Starter Forum Replies Last Post Round() kingroon Classic ASP Basics 1 September 15th, 2008 01:17 PM Round Function in Derived column transformation loveyaseen BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 October 31st, 2007 08:19 AM Problem with Round Function darrenb Access 3 May 22nd, 2007 05:45 PM Decimal place problem...ROUND function! kuku SQL Server 2000 9 July 9th, 2005 05:50 PM Is there a round vbscript function that works? lcsgeek ASP.NET 1.0 and 1.1 Basics 8 August 20th, 2003 11:23 AM