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
|
|||
|
|||
total beginning and ending date
I have two fields named BegTime and EndTime that are using a default value of
time(). Then I have another field named TotalTime that I would like to have a total of these two fields. Example 10:00 + 11:00 = 1.0. Does anyone know how I could do this? Thanks in advance. Karen |
#2
|
|||
|
|||
On Thu, 3 Feb 2005 10:35:07 -0800, "Karen" Karen
@discussions.microsoft.com wrote: I have two fields named BegTime and EndTime that are using a default value of time(). Then I have another field named TotalTime that I would like to have a total of these two fields. Example 10:00 + 11:00 = 1.0. Does anyone know how I could do this? I take it that you want the DIFFERENCE of the two times, not the total - the time elapsed, no? Take a look at the DateDiff() function. Your "TotalTime" field should NOT exist in this table, or any other table; since it can be derived from the BegTime and EndTime values, storing it would be redundant and unwise. Instead, create a Query based on the table; select the BegTime and EndTime fields, and in a vacant Field cell type TotalTime: DateDiff("n", [BegTime], [EndTime]) / 60. to calculate the time difference in minutes and then divide by 60 to get fractional hours. Note that this will not work over midnight; Time() is actually a date/time value on December 30, 1899. If you'll ever want to span midnight, you'ld do better to use Now() rather than Time() as the default, to include both the date and the time. John W. Vinson[MVP] |
#3
|
|||
|
|||
Thank you so much. That points me in the right direction. I had no idea how
to even begin. "John Vinson" wrote: On Thu, 3 Feb 2005 10:35:07 -0800, "Karen" Karen @discussions.microsoft.com wrote: I have two fields named BegTime and EndTime that are using a default value of time(). Then I have another field named TotalTime that I would like to have a total of these two fields. Example 10:00 + 11:00 = 1.0. Does anyone know how I could do this? I take it that you want the DIFFERENCE of the two times, not the total - the time elapsed, no? Take a look at the DateDiff() function. Your "TotalTime" field should NOT exist in this table, or any other table; since it can be derived from the BegTime and EndTime values, storing it would be redundant and unwise. Instead, create a Query based on the table; select the BegTime and EndTime fields, and in a vacant Field cell type TotalTime: DateDiff("n", [BegTime], [EndTime]) / 60. to calculate the time difference in minutes and then divide by 60 to get fractional hours. Note that this will not work over midnight; Time() is actually a date/time value on December 30, 1899. If you'll ever want to span midnight, you'ld do better to use Now() rather than Time() as the default, to include both the date and the time. John W. Vinson[MVP] |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
printing calender with beginning and ending times | Lory | Calendar | 0 | September 28th, 2004 06:05 AM |
Eliminate information at beginning and ending | Craig | General Discussion | 2 | July 27th, 2004 05:48 PM |