If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
sum time duration
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. |
#2
|
|||
|
|||
sum time duration
Whenever you are recording a specific point in time, you use the Date/Time
data type. Whenever you are recording a duration of time, you use a Number data type. The number data type can be integer if you do not need decimals or single or double if you need decimals. Steve "Frances" wrote in message ... 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. |
#3
|
|||
|
|||
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] |
#4
|
|||
|
|||
sum time duration
Hi John, Thank you very much for the suggestion. The result I obtained when
i put the expression in a query gave Duration\60 as a decimal, the seconds were ok. My son found out that the following modifications work which are just slightly different. Displays mm:ss TotDur: [Duration]\60 & Format([Duration] Mod 60,"\:00") Displays hh:mm:ss TotDur2: [Duration]\3600 & Format(([Duration]\60) Mod 60,"\:00") & Format([Duration] Mod 60,"\:00") "John W. Vinson" wrote: 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] |
Thread Tools | |
Display Modes | |
|
|