Discussion Locked

Access - Round off to Hour

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a query with these values:

Field - Event time
Table - Event
Total - Group By

and

Field - Extra time
Table - Event
Total - Group By

Now in the report it works off of:
=([SumEvTime]+[SumExTime])

Now it gives me total time in minutes.
What can I do to it to make it convert to hours?

All I can find in Access is:
Syntax
CONVERT(number,from_unit,to_unit)
Number is the value in From_unit to convert.
From_unit is a text value that specifies the units for Number.
To_unit is a text value that specifies the units for the result.

That is Chineese to me. No examples or anything.

Please assist if you can.
Thank you.
God bless.

11 replies

by borginva

Oh, to nearest hour value. Thank you.

And to correct a mistake:
=([SumEvTime]+[SumExTime])
is really
=([Eventtime]+[extratime])

by sgt_shultz

sorry, borg, don't kill me. it's friday and a full moon. but...
divide by 60?
tell us what you are doing with the db?
did you check out all free sample db's on microsoft website? are you able to get into visual basic help? i assume yes because i see no examples for 'round' function. but i think you are not rounding you are just figuring hours?

by borginva

Ran into other situations and I am going to not bother with this anymore. Too much to figure how to make 37m come up correctly, for example, since that can not be a full 1h or even only .5.
But the points you get.
Thanks for answering.

by sheryl v

Use the datediff function
=datediff("h",[Eventtime],[ExtraTime])
This will return thedifference in hours and you can format the field to however many decimal points you need.

by borginva

Ran into other situations and I am going to not bother with this anymore. Too much to figure how to make 37m come up correctly, for example, since that can not be a full 1h or even only .5.
But the points you get.
Thanks for answering.

by borginva

Sgt, do you mean db-mdbs? If so, no. I never checked the MS website for any. I can never find anything on that site. I even tried some Googling and nothing I found helpes. Must be the words I sue.
I have no examples except that when using
=[Eventtime+[extratime])
It takes the 2 valus in the forms (set as minutes) and just adds them. Total minutes this report could be 7, could be 6.73. But I like them to be rounded up to the nearest hour. The 7 or 6.73 would both be rounded to 1h. 120m would become 2h.
I checked the Access Help. What a waste. Gives me 2 worthless examples I do not understand.

by borginva

Maybe this may help form reading up on other examples that do not help me.
Eventtime and extratime are not dates. They are fixed intergers. 1, 7, 9.46, 567.23, etc.

by borginva

Ran into other situations and I am going to not bother with this anymore. Too much to figure how to make 37m come up correctly, for example, since that can not be a full 1h or even only .5.
But the points you get.
Thanks for answering.

This discussion is closed to new replies.