Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion CAN ACCESS ROUNDUP?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
James A. Fortune  
View profile  
 More options May 25 2006, 6:50 pm
Newsgroups: microsoft.public.access
From: "James A. Fortune" <jimfort...@compumarc.com>
Date: Thu, 25 May 2006 18:50:28 -0400
Local: Thurs, May 25 2006 6:50 pm
Subject: Re: CAN ACCESS ROUNDUP?
need help with rounding in access wrote:

> In need to roundup a simple markup formula for pricing.  Does Access permit
> the rounding up to the nearest $10?

In:

http://groups.google.com/group/microsoft.public.access/msg/d1b5b764da...

Van T. Dinh
MVP (Access)

states:

You can use:

     - Int( - [YourNumber] )

e.g.:

?-Int(-3.2)
  4

That was a very clever idea.  Graphing Int(x), flipping everything
across the Y axis (Right/Left) then flipping everything across the X
axis (Up/Down) shows that that ceiling function is good for all values of X.

Now, adjust the function so that it rounds up to the nearest 10:

-10 * Int(-X / 10#)

The '/ 10#' scales X up by a factor of 10 since 10 units in the new
coordinate system corresponds to 1 unit in the old coordinate system.
The '10 *' scales Y up by a factor of 10 since on the other side of the
equation it looked like Y/10.

Sample calculations:

-10 * Int(-32 / 10#) = -10 * 4 = 40   (32 -> 40)
-10 * Int(--5 / 10#) = -10 * 0 = 0    (-5 -> 0)
-10 * Int(--12 / 10#) = -10 * 1 = -10    (-12 -> -10)
-10 * Int(CCur(12) / 10#) = -10 * 1 = -1  (-$12 -> -10)

Perhaps throw in an NZ() around the field name to guard against Null
field values.

James A. Fortune
MPAPos...@FortuneJames.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.