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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calcuting Time Sheets

Status
Not open for further replies.

gcole

Programmer
Aug 2, 2000
390
US
I am creating a form to calculate hours worked in a time sheet. Adding and subracting time fields gives the correct answer but it in not a value. How can I convert it to a value? The val() command only returns the hour. I need the total minutes.
 
Check out DateDiff() function, It has a interval of minutes that will do the trick.
David Paulson


 
Use the Hour and Minute functions. So, if a user enters a tie of 2 hours 45 minutes,

Hour(#2:45#) = 2

and

Minute(#2:45#) = 45

So, to calculate the total number of minutes:

Dim lMinutes As Long
lMinutes = (60*Hour(#2:45#)) + Minute(#2:45#)

Simon
 
Thank you! I tried the hour() command but couldn't get the minutes.
 
Can you post what you are trying, as the code I posted works??

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top