Rounding up

mrenshaw

Registered User.
Local time
Today, 19:00
Joined
May 3, 2002
Messages
27
I want to round up to whole number based on U. the else needs to round up to the nearest cent. i.e. 1.64 rounds up to 1.65.

The first part works but I can figure out how round up the cents in the else part.
IIf([Item type]="U",+1*Int(+1*[Gross]*1.03),([Gross]*1.03)

Any help would be greatly appreciated.

Michael
 
I think you should look at ROUND() and ROUNDUP() in Access help.
 
dident work

I tried that but can't seem to get it to work in Access. Thanks any way.
 
I use round in an sql in access, it looks like this

ROUND([WORK_LEDGER]![SUM]*[DIST_KEYS]![PERCENT];2)
 
Dim sngDecimalNumber As Single
Dim intIntegerNumber As Integer

sngDecimalNumber = 6.11
intIntegerNumber = CInt(sngDecimalNumber + 0.5)
MsgBox intIntegerNumber 'Returns 7

sngDecimalNumber = 6.6
intIntegerNumber = CInt(sngDecimalNumber + 0.5)
MsgBox intIntegerNumber 'Returns 7
 
mrenshaw said:
I tried that but can't seem to get it to work in Access. Thanks any way.
Give us your code or SQL. These functions work reliably.
 
I’m using an iff statement: IIf([Item type]="U",+1*Int(+1*[Gross]*1.03),([Gross]*1.03)

Item type U needs to round up to whole dollar. The rest need to round up cents. I am using Access 97. I always get an error trying to use the Round function in the above statement so I use Int. This is not completely accurate though.

Thanks very much for your time.

Michael
 
Michael try the following

IIf([Itemtype] = "U", CInt(([gross] * 1.03) + 0.5), [gross] * 1.03)
 
I don't use A97 any more. Perhaps you have a missing reference?
 
Neil/Michael

Unfortunately access 97 does not support the rounding functions ROUND or ROUNDUP.

Allan
 
AAH that explains it. Thanks so much for your time and help. Very much appreciated.

Mahalo,

Michael
 

Users who are viewing this thread

Back
Top Bottom