G
Guest
I am trying to create an Access database to record our employee timecards and
compute wages and overtime.
Our timesheets are a little confusing because we are a tour company and our
guides and work 1, 2, or 3 tours per day, with time off in between. So I've
set up my timesheet database so that I have three sign-in and sign-out times.
Any times between would be unpaid time (similar to a lunch break).
So far, I've got an employees table and a timesheet table and I can enter
timesheet date in a form based on the timesheet table and then display all
hours for a particular employee using a form with subform. So far, so good
with that.
In my subform, I have a calculated field that used the HoursAndMinutes
function that works fine (I found the HoursAndMinutes example on the MS
office website).
My function is:
=HoursAndMinutes(([TimeOut1]-[TimeIn1])+IIf(IsNull([TimeOut2]-[TimeIn2]),0,[TimeOut2]-[TimeIn2])+IIf(IsNull([TimeOut3]-[TimeIn3]),0,[TimeOut3]-[TimeIn3]))
The field that does this computation is called 'Total'.
That gives me an accurate total of the hours and minutes an employee worked
on a given day.
Here's my problem:
Now I want to evaluate the Total field in a new field I've called RegHours
so see if it equals more than 10 hours in a day (we use flex time, so
anything over 10 hours / day is overtime). If Total is greater than 10, then
I want to enter 10 in RegHours and then the different in OT Hours. But
nothing I've tried will work. Everything returns an error unless I do
something really basic like try:
=[Total]
That returns the value I computed in the Total field. So I know my variable
name is okay, but I can't do anything with this.
I suspect is my have something to do with the fact I'm working with Times?
Can anyone help? I can do this fine in Excel, but can't figure out for the
life of me how to do this in Access.
I tried variations on:
= IIf([Total]>10,10,[Total])
But anything similar to this returns an error. I've also tried
Min(10,[Total]) which also returns an error.
Can anyone help?
compute wages and overtime.
Our timesheets are a little confusing because we are a tour company and our
guides and work 1, 2, or 3 tours per day, with time off in between. So I've
set up my timesheet database so that I have three sign-in and sign-out times.
Any times between would be unpaid time (similar to a lunch break).
So far, I've got an employees table and a timesheet table and I can enter
timesheet date in a form based on the timesheet table and then display all
hours for a particular employee using a form with subform. So far, so good
with that.
In my subform, I have a calculated field that used the HoursAndMinutes
function that works fine (I found the HoursAndMinutes example on the MS
office website).
My function is:
=HoursAndMinutes(([TimeOut1]-[TimeIn1])+IIf(IsNull([TimeOut2]-[TimeIn2]),0,[TimeOut2]-[TimeIn2])+IIf(IsNull([TimeOut3]-[TimeIn3]),0,[TimeOut3]-[TimeIn3]))
The field that does this computation is called 'Total'.
That gives me an accurate total of the hours and minutes an employee worked
on a given day.
Here's my problem:
Now I want to evaluate the Total field in a new field I've called RegHours
so see if it equals more than 10 hours in a day (we use flex time, so
anything over 10 hours / day is overtime). If Total is greater than 10, then
I want to enter 10 in RegHours and then the different in OT Hours. But
nothing I've tried will work. Everything returns an error unless I do
something really basic like try:
=[Total]
That returns the value I computed in the Total field. So I know my variable
name is okay, but I can't do anything with this.
I suspect is my have something to do with the fact I'm working with Times?
Can anyone help? I can do this fine in Excel, but can't figure out for the
life of me how to do this in Access.
I tried variations on:
= IIf([Total]>10,10,[Total])
But anything similar to this returns an error. I've also tried
Min(10,[Total]) which also returns an error.
Can anyone help?