Rounding up numeric value

M

Mary

Hello,
I am using the following statement to determine the amount of time to charge.

TotFractTime: Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)

I now need to round this up to the next whole number, even if the result is
4.25, it needs to round up to 5.

Thanks!
Mary
 
J

JL

Hi Mary.

Try Int().
Int(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4))
 
J

JL

Sorry,

Int() will force to be the integer part of the value.

Int(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4) +.5)
 
J

JL

Hi Mary,

Never mind. It still not right. Let me check something else.


JL said:
Sorry,

Int() will force to be the integer part of the value.

Int(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4) +.5)


Mary said:
Hello,
I am using the following statement to determine the amount of time to charge.

TotFractTime: Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)

I now need to round this up to the next whole number, even if the result is
4.25, it needs to round up to 5.

Thanks!
Mary
 
J

JL

Hi Mary,

Try Round().

Round(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)+.5)
 
M

Mary

JL, I get an error that the Round statement contains an undefined function.
Do I need to set that up as function first?

Thanks,
Mary

JL said:
Hi Mary,

Try Round().

Round(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)+.5)


Mary said:
Hello,
I am using the following statement to determine the amount of time to charge.

TotFractTime: Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)

I now need to round this up to the next whole number, even if the result is
4.25, it needs to round up to 5.

Thanks!
Mary
 
B

Brendan Reynolds

If I remember correctly, the Round function was new in Access 2000/VBA 6. If
you're using an earlier version (or if the behaviour of the built-in
function doesn't suit your needs) try this custom VBA rounding function ...

http://www.mvps.org/access/modules/mdl0054.htm

--
Brendan Reynolds (MVP)


Mary said:
JL, I get an error that the Round statement contains an undefined
function.
Do I need to set that up as function first?

Thanks,
Mary

JL said:
Hi Mary,

Try Round().

Round(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)+.5)


Mary said:
Hello,
I am using the following statement to determine the amount of time to
charge.

TotFractTime: Val(Hour([ElapseTime]))+(Int((Minute
([ElapseTime])+14)/15)/4)

I now need to round this up to the next whole number, even if the
result is
4.25, it needs to round up to 5.

Thanks!
Mary
 
J

JL

Hi Mary,

If you are using Office 2000 and above, you are likely missing your library
references. Hit Alt+F11. It will bring you to the VBA Editor. Under Tools
and Reference. Make sure you have at least the following checked.

- Visual Basic For Applications
- Microsoft Access 9.0 Object Library
- OLE Automation
- Microsoft ActiveX Data Objects 2.5 Library
- Microsoft DAO 3.6 Objecdt Library


Mary said:
JL, I get an error that the Round statement contains an undefined function.
Do I need to set that up as function first?

Thanks,
Mary

JL said:
Hi Mary,

Try Round().

Round(Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)+.5)


Mary said:
Hello,
I am using the following statement to determine the amount of time to charge.

TotFractTime: Val(Hour([ElapseTime]))+(Int((Minute ([ElapseTime])+14)/15)/4)

I now need to round this up to the next whole number, even if the result is
4.25, it needs to round up to 5.

Thanks!
Mary
 
Top