Addition Of "Short Time"

T

trunky

Can someone help PLEASE?

I need to calculate the sum of a number of different "Short Time's"

The problem i have is that Access adds the values until i get to 24 hrs and
then includes the Date and adds a day to it. I just want the hours & Minutes
to add up to give me a total in hours and minuets. Is it possible, i have
tried to use the format statement to format the values to a short time and
then add them but i get a type mismatch??

Any ideas

Thanks
 
R

Rick Brandt

trunky said:
Can someone help PLEASE?

I need to calculate the sum of a number of different "Short Time's"

The problem i have is that Access adds the values until i get to 24
hrs and then includes the Date and adds a day to it. I just want the
hours & Minutes to add up to give me a total in hours and minuets. Is
it possible, i have tried to use the format statement to format the
values to a short time and then add them but i get a type mismatch??

Any ideas

Thanks

Access does not store what you are calling short times as "amounts of time". It
stores them as times of day on 12/30/1899.

If you need to work with durations you should store the amount of hours or
minutes or seconds, etc., as numeric values. Then you can perform arithmetic
operations on those values. End results can be *displayed" in a hours:minutes:
seconds format, but it is not a good idea to store them that way.

If you insist on storing them in a DateTime field you can sum them and then use
DateDiff to determine the difference between your result and the date
12/30/1899. That might work for you (though I've not actually tried it).
 
K

Ken Snell \(MVP\)

In what context are you adding these values together, and then in what
context are you displaying the result?
 
J

James A. Fortune

trunky said:
Can someone help PLEASE?

I need to calculate the sum of a number of different "Short Time's"

The problem i have is that Access adds the values until i get to 24 hrs and
then includes the Date and adds a day to it. I just want the hours & Minutes
to add up to give me a total in hours and minuets. Is it possible, i have
tried to use the format statement to format the values to a short time and
then add them but i get a type mismatch??

Any ideas

Thanks

I posted some functions for time conversion, addition/subtraction and
display in the following thread:

http://groups.google.com/group/microsoft.public.access/browse_frm/thread/be7e101c5176ebd8

It should be a small change to use just hours instead of days and hours.
Post back if you need help with that.

James A. Fortune
(e-mail address removed)
 
T

trunky

Just in case you’re interested.

The problem is sorted,

I converted the "Short Time" into minuets with a little function and then used

TimeSerial (0,Mins,0)

All working

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top