View Single Post
  #3  
Old July 7th, 2009, 11:08 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default sum time duration

On Tue, 7 Jul 2009 14:40:01 -0700, Frances
wrote:

I am making a database of musical compositions each with several tracks
lasting just a few minutes and seconds . I want to be able to sum the
duration of the tracks for each compositon.
Please can you tell me how to do this? I have tried formatting the field
'Duration' as 'Date/Time' but how can I designate it as minutes:seconds and
not the hours:minutes of Short time? Then how would I sum the times?
I tried choosing short time and put an input mask of __:__but when I summed
the field I got a decimal number.
Thank you for any help you can give.


I would suggest storing the duration in a Long Integer field holding seconds
(e.g. a track that runs 4 minutes 15 seconds would contain 255). Date/Time
fields are designed to store a specific point in time, not a duration, and
don't add/subtract well. (The decimal you're getting is fractions of a day,
the unit used for date/time).

You can display a duration in minutes:seconds with an expression

=Duration\60 & ":" & Format([Duration] MOD 60, "00")

In addition you can have minutes and seconds textboxes on a form, and move
data to and from these with some simple code.
--

John W. Vinson [MVP]