Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Fri Jun 6 12:34:55 CDT 2008
Even better?: Public Function RoundUp(ByVal value As Double) RoundUp = Sgn(value) * Abs(Int(-Abs(value))) End Function It will work for negative values also.... -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stephen Sent: Friday, June 06, 2008 8:28 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Rounding UP Precisely ! And far more elegant ..... :-) Stephen Bond -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Saturday, 7 June 2008 4:22 a.m. To: Stephen Subject: Re: [AccessD] Rounding UP abs(int(-(YourFpNumber))) ? -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stephen Sent: Friday, June 06, 2008 7:59 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Rounding UP I suspect a simple ROUND as specified will have an undesirable side-effect. It works in most cases but not all. If, for example, you add 12 and a half percent to 8, you get 9 - exactly. This formula round(YourFpNumber + 0.5,0) will take the 9 and make it 10. IOW, adding 12 and a half percent to 8 will give 9 exactly, then the formula above takes it to 10. Is this what you want to happen? If it isn't then you need something a bit more complex. Using 1.125 for an increase of 12 and a half percent, in a query new: IIf(Int(1.125*[old])=1.125*[old],1.125*[old],Round(0.5+1.125*[old],0)) should take care of all cases. BTW, Excel has a wonderful ROUNDUP function which would do this in a snip. Not in Access 2003. Stephen Bond -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jeff Barrows Sent: Saturday, 7 June 2008 3:31 a.m. To: Stephen Subject: Re: [AccessD] Rounding UP Thanks! That did the trick! On 6/6/08, Heenan, Lambert <Lambert.Heenan at aig.com> wrote: > > Try: round(YourFpNumber + 0.5,0) > > Lambert > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jeff > Barrows > Sent: Friday, June 06, 2008 11:10 AM > To: accessd > Subject: [AccessD] Rounding UP > > In Access 2003, is there a way to ALWAYS round UP to the next whole number? > I am trying to calculate stock needed to create parts and need to > determine whole pieces of stock, not partials. > > TIA > > Jeff Barrows > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com