......the boss wants the time worked represented in hours and tenths of hours not minutes. How can I take the time, seperate the hours...find out how many tenths of an hour worked and then add the hours and tenths together.
If you mean time worked represented in
Hours with decimal places, you can use the expression:-
([EndTime]-[StartTime])*24
as [EndTime]-[StartTime] remains a date/time value and the unit of a date/time value is day and each day has 24 hours. If your version of Access has the Round() function, you can round it to 3 or 4 decimal places e.g.
Total Hours: Round(([EndTime]-[StartTime])*24,3)
However, if what you want are the number of Hours and the number of complete 10ths of Hour, you can use these two expressions:-
Hours: DateDiff("s", [StartTime], [EndTime])\3600
10thsHour: (DateDiff("s", [StartTime], [EndTime]) Mod 3600)\360
See the two queries in the attachment.
- Query1 illustrates the using of the above three expressions.
- Query2 shows how to sum the three expressions by ID.
.