View Single Post
  #3  
Old November 23rd, 2006, 04:19 PM posted to microsoft.public.access.queries
Marco
external usenet poster
 
Posts: 535
Default Problem is sum hours, because when cross 24h start in zero

Hi. thanks for your reply. I already have the column hours in long integer.
I have this total sum: 45,75399583.

If it was in excel, I format in costum as [h] it will work fine. I wanted
to do the same in access, in querie or form. in excel I can get 1098 but not
in access.

Regards,
Marco



"Rick Brandt" wrote:

"Marco" wrote in message
...
Hello. How can I sum a total of hours. I'm having this problem. When the
total of hours cross 24h it restart, like it was passing to another day.
Exemple: 18.00H+10.00h appears as 04.00h. and I wnat to appear 26.00h.

Con should I format this? In excel I format as [h] and it works, but it's
not working here.


Databases do not have a data type for storing *amounts of time*. The DateTime
field is intended for "points in time". In a database 18:00 means 6 PM, not 18
hours and zero minutes.

Since many database systems store DateTimes under the covers as numeric values
you can sometimes get way with using these fields as if they were durations, but
as you have seen that blows up when you cross 24 hour boundaries.

The recommended approach is to store your durations as regular numbers like the
number of minutes or the number of seconds using an Integer or Long Integer
field. Then you can do all kinds of math on them easily. Final results can for
display purposes be converted back to an hours and minutes format.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com