Add 2 Time fields together

jmccullough

Registered User.
Local time
Today, 12:17
Joined
Jul 30, 2007
Messages
24
I have an Access 2010 database that tracks Classroom Training. I have a "Start Time" field for each class and a "Duration" field for the length of each class. The Start Time field is a date/time data type and the Duration field is a number data type set to Double with 1 decimal place.
Example:
Start Time = 8:00
Duration = 1.5

So the class should have an End Time at 9:30. I have been able to convert the "Duration" field to a time field for example 1.5 now displays 1:30.

My question is how do I add the 2 fields together to get an End Time of 9:30 ????

Any help would be greatly appreciated.
 
You can use the DateAdd function (http://www.techonthenet.com/access/functions/date/dateadd.php) to add times to a date/time. One caveat--it can only use whole number units. It can add hours to a time, but it won't work on 1.5 (it just looks at the integer part).

That means you need to multiply your duration by 60 and add minutes to your date/time field.
 
Don't know your formats or field types but here are a few examples:
ClockTime: DateDiff("n",[ClockTimeIn],[ClockTimeOut])/60

TotalTime: [Minutes]\60 & Format([Minutes] Mod 60,"\:00")

Minutes: DateDiff("n",[ClockTimeIn],[ClockTimeOut])

GrandTotal: Sum(DateDiff("n",[ClockTimeIn],[ClockTimeOut])/60)

HTH
 
If as you say both fields are proper date/time fields its a simple addition:
Starttime + Duration
 
Don't know your formats or field types...If as you say both fields are proper date/time fields

Seriously guys, get to the party on time or read the poster's issue in its entirety. One or the other.

The Start Time field is a date/time data type and the Duration field is a number data type set to Double with 1 decimal place.
 

Users who are viewing this thread

Back
Top Bottom