Count Code Help Needed, Please

D

Dave Elliott

I have a sub-form on my main form that i use to show the employee,hours and
day employee worked
the Combo Box Employee Time shows the employee for the record
the Text34 box shows the day the employee worked
there can be many workers on any given day or just one.
I need to calculate the number of employees on each day

The Combo Box Employee Time looks up the employee by EmployeeID and shows
the employees name.
via the table/query Employee


The text34 box shows the day using this code =Format([Work Date],"dddd")
It gets it from the textbox WorkDate which shows the complete date, i.e.
04/29/05


How or can i do this?
 
G

Guest

Dave,

I don't think I understand. You are using the combo box to look up one
employee from the Employee table, but then you say you want to calculate the
number of employees on each day. The two don't seem to relate. If you are
looking for the number of employees that worked on a given day, why not just
a DCount?

=DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate
 
D

Dave Elliott

The below code helped me get closer to my goal, Thanks
I am trying to see what record there is more than 3 people on so i can
adjust the pay rate for that day only or whatever
other record for the sub-form that is for the main record (main form) that
has more than 3 people on it.
short explanation is: if i have 3 people on the same day on the same job,
then the rate goes up, if just 2 or less,
then pay rate stays the same. trying to get this formula together so that i
can invoice the customer correctly.
rate is $65.00 for either one or two people on the same day, but if three or
more, then an additional $32.50
for each man hour worked.Very Complicated for me...

Klatuu said:
Dave,

I don't think I understand. You are using the combo box to look up one
employee from the Employee table, but then you say you want to calculate
the
number of employees on each day. The two don't seem to relate. If you
are
looking for the number of employees that worked on a given day, why not
just
a DCount?

=DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate

Dave Elliott said:
I have a sub-form on my main form that i use to show the employee,hours
and
day employee worked
the Combo Box Employee Time shows the employee for the record
the Text34 box shows the day the employee worked
there can be many workers on any given day or just one.
I need to calculate the number of employees on each day

The Combo Box Employee Time looks up the employee by EmployeeID and
shows
the employees name.
via the table/query Employee


The text34 box shows the day using this code =Format([Work
Date],"dddd")
It gets it from the textbox WorkDate which shows the complete date,
i.e.
04/29/05


How or can i do this?
 
D

Dave Elliott

Whoops, spoke too soon. Code does not show me if there are more than 2
employees on the same day.
=DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate)





Klatuu said:
Dave,

I don't think I understand. You are using the combo box to look up one
employee from the Employee table, but then you say you want to calculate
the
number of employees on each day. The two don't seem to relate. If you
are
looking for the number of employees that worked on a given day, why not
just
a DCount?

=DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate

Dave Elliott said:
I have a sub-form on my main form that i use to show the employee,hours
and
day employee worked
the Combo Box Employee Time shows the employee for the record
the Text34 box shows the day the employee worked
there can be many workers on any given day or just one.
I need to calculate the number of employees on each day

The Combo Box Employee Time looks up the employee by EmployeeID and
shows
the employees name.
via the table/query Employee


The text34 box shows the day using this code =Format([Work
Date],"dddd")
It gets it from the textbox WorkDate which shows the complete date,
i.e.
04/29/05


How or can i do this?
 
G

Guest

I lost you again when you said "man hour", but this will give you the basics
In the statement below the DDcount function returns the number of Employees
that worked on a specific date.

MenWorked =DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate
If MenWorked < 3 Then ' Two or fewer men worked so
PayRate = 65 ' Rate is $65.00
Else
ExtraMen = MenWorked - 2 ' Count the extra men
PayRate = 65 + (ExtraMen * 32.5) ' Start with the orignina $65.00 and add
Endif ' Multiply the number
of extra men by
' $32.50
This is per day. If this by hours and the $65.00 is an hourly rate, then
just multiply the PayRate by the number of hours.

If I am still (be patient, I'm old and confused) missing the point, please
clarify.

Dave Elliott said:
The below code helped me get closer to my goal, Thanks
I am trying to see what record there is more than 3 people on so i can
adjust the pay rate for that day only or whatever
other record for the sub-form that is for the main record (main form) that
has more than 3 people on it.
short explanation is: if i have 3 people on the same day on the same job,
then the rate goes up, if just 2 or less,
then pay rate stays the same. trying to get this formula together so that i
can invoice the customer correctly.
rate is $65.00 for either one or two people on the same day, but if three or
more, then an additional $32.50
for each man hour worked.Very Complicated for me...

Klatuu said:
Dave,

I don't think I understand. You are using the combo box to look up one
employee from the Employee table, but then you say you want to calculate
the
number of employees on each day. The two don't seem to relate. If you
are
looking for the number of employees that worked on a given day, why not
just
a DCount?

=DCount("[EmployeeID]","Employees","[Work Date] = " & WorkDate

Dave Elliott said:
I have a sub-form on my main form that i use to show the employee,hours
and
day employee worked
the Combo Box Employee Time shows the employee for the record
the Text34 box shows the day the employee worked
there can be many workers on any given day or just one.
I need to calculate the number of employees on each day

The Combo Box Employee Time looks up the employee by EmployeeID and
shows
the employees name.
via the table/query Employee


The text34 box shows the day using this code =Format([Work
Date],"dddd")
It gets it from the textbox WorkDate which shows the complete date,
i.e.
04/29/05


How or can i do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top