Hi my friend :-)
It's probably a lot easier than you may think. If you store your durations in Date/Time variables then everything just works. Look beyond the fact that one total would display as one particular Date & Time in history and when another duration is added it becomes equivalent to another Date & Time in history. That is only one interpretation of the data.
In Access 5 mins + 4 mins 30 secs + 6 mins 25 secs is equivalent to :
That seems a bit weird, obviously. However, that's because you're thinking of the value as a Date/Time instead of as a Duration.
Once you start thinking of it as a Duration you then start to see how it can work. The following makes much more sense. Bear in mind these are not Times in a day, and especially not Times of any particular Date. They're just Elapsed Time (Duration). 00:05:00 is not five past midnight. It's stored the same way, using the same value even, but instead it represents a Duration of 5 minutes.
Again, the result doesn't represent any specific Time of Day. We are not talking early hours of the morning at quarter past midight (~). Just an Elapsed Time of just over quarter of an hour in total.
As I said above (or below if you view posts in reverse order), when your values exceed a day then you need to be a bit creative with how they're displayed for a user, but don't let the display aspect confuse you. It does a fine job of maintaining the data for you.
Using the Format function in VBA (or SQL) you can show durations by displaying them twice like so :
NB. As this is simple clarification of the original question and is useful to anyone looking for help on this subject there's no need for a separate question thread on it.
I hope I've answered your query adequately ADezii :-)
It's probably a lot easier than you may think. If you store your durations in Date/Time variables then everything just works. Look beyond the fact that one total would display as one particular Date & Time in history and when another duration is added it becomes equivalent to another Date & Time in history. That is only one interpretation of the data.
In Access 5 mins + 4 mins 30 secs + 6 mins 25 secs is equivalent to :
Code:
30/12/1899 00:05:00 + 30/12/1899 00:04:30 + 30/12/1899 00:06:25 = 30/12/1899 00:15:55
Once you start thinking of it as a Duration you then start to see how it can work. The following makes much more sense. Bear in mind these are not Times in a day, and especially not Times of any particular Date. They're just Elapsed Time (Duration). 00:05:00 is not five past midnight. It's stored the same way, using the same value even, but instead it represents a Duration of 5 minutes.
Code:
00:05:00 + 00:04:30 + 00:06:25 = 00:15:55
As I said above (or below if you view posts in reverse order), when your values exceed a day then you need to be a bit creative with how they're displayed for a user, but don't let the display aspect confuse you. It does a fine job of maintaining the data for you.
Using the Format function in VBA (or SQL) you can show durations by displaying them twice like so :
Code:
Debug.Print Format(datDuration, "0"); Format(datDuration, " HH:nn:ss");
I hope I've answered your query adequately ADezii :-)
Comment