I can't remember right now what your problem might be, but if you dig around here: http://www.mvps.org/access/datetime/index.html you will probably find an example that helps fix your calculation. I am sure that it has to do with how you are formatting your result.
Good Luck. Dawn Crosier Application Specialist "Education Lasts a Lifetime" This message was posted to a newsgroup. Please post replies and questions to the group so that others can learn as well. -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of eileen1309 Sent: Thursday, October 06, 2005 5:49 PM To: [email protected] Subject: [ms_access] Need Help in calculating time? I need to be able to reflect total hours worked. On my form I have two fields StartDate and Enddate both fields have the full date and time. this is the code I have but the result is not correct based on the data in the two fields. StartDate = 10/05/2005 11:25:00 AM EndDate = 10/05/2005 6:00:00 PM Total Hrs worked should equal 5.25hrs. Here's My code where am I going wrong. Function NoHours() On Error GoTo noHourserr Dim y As Double Dim z As Variant y = DateDiff("n", Forms![UfrmTaskactions]![StartDate], Forms! [UfrmTaskactions]![EndDate]) / 60 NoHoursExit: Exit Function noHourserr: MsgBox Err.Number & " " & Err.Description Resume NoHoursExit End Function ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/q7folB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
