PDA

View Full Version : Caluclations in time and form fields



GoKats78
11-26-2008, 05:02 AM
I am trying to devlop a form, using form fields, that will calculate hours worked based on inputs in fields. I cannot get the calculations to return the correct hours worked...

For example, I enter 6:00 in Mon In and 14:30 in Mon_out - the resulting calcualtion, =(mon_out)-(mon_in), returns 26.00


What's going on?

GoKats78
11-26-2008, 05:26 AM
I thought I had it...until I added "Minutes" to the equation..


I uploaded an updated sheet...

fumei
11-26-2008, 10:18 AM
Hmmm. If I put in 6:30 in Mon_in and 14:30 in Mon_out, it shows as 8:00.

However, changes to your fields can get odd. You may want to add something that will update your calculation fields.

macropod
11-26-2008, 02:01 PM
Hi GoKats78,

Field calculations for times and dates are not trivial. IMHO, a macro or, better yet, an Excel workbook, would be much better suited to timesheet development.

However, if you're wedded to field calculations, you can see how to do this and just about everything else you might want to do with times & dates in Word, with my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

In particular, look at the item titled 'Add Or Subtract Two Time Periods'. Do read the document's introductory material.

GoKats78
11-26-2008, 08:12 PM
Thanks macro...I am not wedded to calculations...I am, however, stuck with this as a word document. It is not my document but I have been asked to make it work....

Both those links take me to the VBA Express home page.

macropod
11-26-2008, 08:21 PM
Hi GoKats78,

The links should work now.

lucas
11-26-2008, 09:56 PM
Hi GoKats78,

Field calculations for times and dates are not trivial. IMHO, a macro or, better yet, an Excel workbook, would be much better suited to timesheet development.



Or a userform that does the calculations and then puts times and the results in bookmarks in the word doc.....which is probably what you meant when I think about it.....