Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing a Time Field 1

Status
Not open for further replies.

joatmofn

Technical User
Jan 12, 2003
72
US
My report displays EmployeeName, Date Worked, Time-In, Time-Out. Time-In and Time-Out are stored as date/time.

I created a query to pull in the necessary fields and created a TotalHours expression in the query. The TotalHours correctly performs the math on the Time-In and Time-Out fields and formats the result to a "short Time".

So far so good! But...

In my report, I created a header section for the employee. The detail section shows each date the employee worked along with the time-in and time-out fields. Because the report is based on the query, it also shows the TotalHours field (correctly calculated and formated to a short time).

So far so good! But...

I placed an employee footer section to show the total hours worked for the employee. I thought it would be easy to simply create a field, place it in the footer section and set the controlsource to = sum([TotalHours]).

Ha!

It didn't produce the expected results. I tried unformatting the TotalHours field and summing and formatting the result. But this did not work either. I've tried other things as well, but just can't get it right.

Any help you can provide would be appreciated.

Thanks.
 
To sum up hours and minutes they must be converted first to a decimal equavalent of hours(i.e. 2.34 hrs) and then summed up and displayed as hours and minutes.

I provided some VBA code to perform this function in the following code:

thread701-552245

Let me know if this helps you with your report.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top