Timesheet calculations

aman

Registered User.
Local time
Today, 04:47
Joined
Oct 16, 2008
Messages
1,251
Hi All

I am designing a timesheet system. In this if you see the attached file there are diff boxes for hours and minutes. Minutes are 15 min block so the user can only type 0,15,30,45 in mm boxes. and in hh boxes they can type whole numbers from 0 to 10. I have put all the validations in my system.Now the problem is I want the total like 7.15 .so that when the user press enter after typing values in boxes then it should display in the total box 7.15 means they have worked 7 hours and 15 minutes on Monday.

Suppose I enter some values in these hh and mm boxes and press enter and it gives me 5.135 answer in total textbox. So the answer should be 7.15. Can anyone please give me the code to do this calculation. Please find attached a sample file.
 

Attachments

If you are going to go the way you want, you are going to have to redo how you generate the minutes. Since you are using 15 minute blocks, you cannot simply just add them together. Once the minutes go over 60, then it actual one hour.

So what you can do is add up the minutes, then divide by 60. Then simply

a + b

and it will add the two totals together and get the desired result.

I also noticed that you dont have any tables. Are you planning on storing the data, or just using Access as a calculator? If the former, you should really map out your tables before worrying about forms.

Also, I have a time sheet system implimented in my database here at work. If you would like, I can try and isolate it into a new db if you would like to see a different perspective on how it can be done.
 
Hi

Yeh I know I have to add the minutes and divide by 60. But it gives me result like 7.25 and not 7.15. I want the answer like 7.15 [again minutes in 15min block]so that employess know they have worked 7 hours and 15 min on that day.

And about table,in my system I am definetely storing the values .Its just an example to explain you what I want exactly.Yes I would really appreciate if you can send me the timesheet system you developed. It will definetely help me a lot.My gmail id is oberoi.amanpreet@gmail.com. Can you please send me on this id.

Thanks
Aman
 
By dividing by 60, that is exactly what will happen. For example:

Entry 1: 4h 15min
Entry 2: 1h 30min
Entry 3: 2h 45min
Entry 4: 4h 15min

Now, with the way you currently have it, the end result will show the following:

10h 105min

Adding them together you get 12.75 with dividing them by 60. You will have to add some code to basically convert the .75 to reflect actual minutes. My bad for not thinking about that with my last post.
 
I orginally sent it out to you on the 10th. I have resent it.
 

Users who are viewing this thread

Back
Top Bottom