Format a Time field for calculations

  • Thread starter Thread starter Gail
  • Start date Start date
G

Gail

I am trying to create a time sheet where I need to
calculate the # of hours worked in a day for each employee
and use the # of hours, multiplied by the employee's rate
to get a total amount to be paid.

I have taken a time formatted field (TotalHoursWorked)
which has been calculated from a "TimeIn" field and
a "TimeOut" field and need to use this to calculate
the "TotalAmountToBePaid" by multiplying
the "TotalHoursWorked" (time formatted) by the "Rate"
(currency) to get this.

My "Total Hours" is formatted to show "02:30" to represent
2 hours and 30 minutes of time worked, but I get "#Error"
when I try to multiply this by the "Rate".

How can I get this to work so that I can still see the
number of "TotalHoursWorked" and have it calculate
a "TotalAmountToBePaid"?

I know that it all has to do with the formatting of these
fields, but cannot get anything to work. Thank you in
advance for any help that you can provide.
 
Are you using the Format function, which returns a string?

Try multiplying the time by 24. That should give you a decimal value of the
number of hours

?#2:30# * 24
2.5
 
I got it! Thank you so much!!!!
Gail

-----Original Message-----
Are you using the Format function, which returns a string?

Try multiplying the time by 24. That should give you a decimal value of the
number of hours

?#2:30# * 24
2.5

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)






.
 
Back
Top