how can i calculate to get the total accumulated hours

calimlimrodel

Registered User.
Local time
Tomorrow, 02:28
Joined
Feb 12, 2008
Messages
10
hi, need help....i have 4 text boxes named Started_Date, Started_Time, End_Date & End_Time. how can i calculate to get the total accumulated hours between Started Date/Time & End Date/Time? Thanks in advance..
 
ever tried datediff? concatenate StartDate and Time and Enddate and Time and feed it to the DateDiff function!

Enjoy!
 
Can you be a little more descriptive please. Can you tell me basically what the data looks like? For example, I have been working on a application that calculates how much over time a person gets i.e. how much time and half and double time if a person worked over their alloted hours. I think I can help you, but you need to give me a little more to work with.

For instance are you running a query to get the sum of the totalhours? This is what I am doing, then I base the contents of my fields on calculations based on the result of the query.
 
Last edited:
Why do you use 4 textboxes instead of two? if you join Date and Time in one textbox, it is easier to work with e.g. mm-dd-yyyy hh:mm". You can store it in two fields in the database and querying it is a lot simpler.

When stored in the database you use datediff to get the number of hours between the two entries:
Code:
Select StartDate, EndDate, DateDiff("h",[StartDate],[EndDate]) as HoursExpired from Table
See the sample database

Enjoy!
 

Attachments

Why do you use 4 textboxes instead of two? if you join Date and Time in one textbox, it is easier to work with e.g. mm-dd-yyyy hh:mm". You can store it in two fields in the database and querying it is a lot simpler.

When stored in the database you use datediff to get the number of hours between the two entries:
Code:
Select StartDate, EndDate, DateDiff("h",[StartDate],[EndDate]) as HoursExpired from Table
See the sample database

Enjoy!

Sorry to ask you again....
Where i can put this code? is it in the query? or in the event procdure? I can't open your sample dbase please see attached....Thanks
 

Attachments

Can you be a little more descriptive please. Can you tell me basically what the data looks like? For example, I have been working on a application that calculates how much over time a person gets i.e. how much time and half and double time if a person worked over their alloted hours. I think I can help you, but you need to give me a little more to work with.

For instance are you running a query to get the sum of the totalhours? This is what I am doing, then I base the contents of my fields on calculations based on the result of the query.


This is based on the form object, once the Start Date/Time & End Date/Time input in the textbox the total hours will appear in another textbox name Total Hrs...I think your right, its better to use quey to get the total hrs, please give some sample or code. please see attached for more detail information.. tnx a lot..
 

Attachments

What Access version are you using? I am using 2003. Apparently you use a earlier version. Here's a Acc97 version of the database.

When you want to calculate the number of hours in a form, don't store it in the database.

Enjoy!
 

Attachments

What Access version are you using? I am using 2003. Apparently you use a earlier version. Here's a Acc97 version of the database.

When you want to calculate the number of hours in a form, don't store it in the database.

Enjoy!


Thanks you help me alot.....
 

Users who are viewing this thread

Back
Top Bottom