Hey guys! I have created an Access 2010 database. On one of the tables, there are fields [Start Time], [End Time] and [Total Time]. The user will input the start and end times but and the total time will be the difference between the two. I cannot figure out how to go about this. Any help or direction would be greatly appreciated!!

Re: Calculating Time 80 80

use the datediff function, inspite of its name it handles times as well as dates.

Re: Calculating Time 80 80

Thanks for you input Chris! I have tried to implement the DateDiff function but have ran into a snag. Below is how I am using it in a query.

Total Time: DateDiff("Short Time",[Work Start Time],[Work End Time])

It is returning "#Func!". Do you have any idea what could be causing this?

Re: Calculating Time 80 80

datediff returns a number, ie number of days, number of hours, number seconds depending on the first parameter. so if you want the number of hours between the two the call looks like

noHours = datediff("h",[Work Start Time],[Work End Time])

or in SQL

noHours:datediff("h",[Work Start Time],[Work End Time])
Re: Calculating Time 80 80

That worked! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.