View Full Version : No one seems to know the answer...


dortoh
01-13-2002, 05:32 PM
Rounding Up
I have some money tables that display one products prices. I would like to be able to round to .05 ¢. For instance, 2.54 should equal 2.55 and 2.56 should equal 2.60. I hope this is possible?

Extra Info:
1. The queries create make-tables that eventually get displayed on the web: http://www.kcscott.net/ASP_AdjustableWallorBeamSleeve.asp#Price

2. Here is the querry code to date:

4-7: Format((tblAdjustableWallBeamSleeve![4-7]*Forms!frmPercentage![Percentage])+tblAdjustableWallBeamSleeve![4-7],"$#.00")

To look more professional...I would like to round. Thanks in advance for your alls time.
Dortoh

Jack Cowley
01-13-2002, 06:55 PM
Search the archives here as I believe that this has been addressed before....

dortoh
01-13-2002, 08:47 PM
Yea, I thought so too...I searched prior, although no luck or everything I looked at made no sense as to what I need to accomplish. I am working with a query and in that query I would like to round up by .05 cents. I have tried the round() function although, it rounds to the whole number nothing below like .05? Any ideas.
Thanks.

Fornatian
01-14-2002, 04:29 AM
In excel, you can use:

=INT(B9)+IF(MOD(B9,1)<=0.5,0.5,1)

I'm sure it will easily convert to Access.

Ian

dortoh
01-14-2002, 08:39 AM
No luck http://www.access-programmers.co.uk/ubb/frown.gif Thanks

KKilfoil
01-14-2002, 08:56 AM
To round to 0.05, depending on what you want:

rounddown: Int([numfield]*20)/20

roundup: Int([numfield]*20)/20+0.05

roundnearest: (Int(([numfield]+0.025)*20))/20

dortoh
01-14-2002, 09:34 AM
IT WORKED GREAT... http://www.access-programmers.co.uk/ubb/smile.gif
Thank you for your help.

For anyone thats reading up here's the finished product:

4-7: Format(Int(((tblAdjustableWallBeamSleeve![4-7]*Forms!frmPercentage![Percentage])+tblAdjustableWallBeamSleeve![4-7])*20)/20+0.05,"$#.00")

Thanks again KKilfoil

Now comes the fun of modifing all the queries... http://www.access-programmers.co.uk/ubb/frown.gif

[This message has been edited by dortoh (edited 01-14-2002).]

KKilfoil
01-15-2002, 10:27 AM
If you're going to do this many times in diffrent queries, you might want to consider creating a public function. Then just pass it the single value to be rounded.

dortoh
01-15-2002, 10:48 AM
Do you think this is possible to be walked thru? It sounds a bit out of my league...although, I am willing to learn.