SELECT Hours.SinMar, Hours.NoAllow, Hours.PayRate, Hours.Hours,
IIf([TEmpOrCon].[EmpOrCon]=0.2,1*[PayRate],[Hours]*[PayRate]) AS RegPay,
Hours.OTRate, Hours.Overtime, [Hours].[OTRate]*[Overtime]*[PayRate] AS
OTPay, [RegPay]+[OTPay] AS ExpPayPerDay, Hours.TimeID, Hours.HoursID,
Hours.EmployeeID, Employees.[First Name], Hours.[Work Date], Employees.[Last
Name], Hours.ChkNoID, IIf(IsNull([ChkNoID]),0,-1) AS Paid
FROM (Hours LEFT JOIN Employees ON Hours.EmployeeID = Employees.[Employee
ID]) LEFT JOIN TEmpOrCon ON Employees.EmpOrCon = TEmpOrCon.EmpOrConID
ORDER BY Hours.[Work Date] DESC , Employees.[Last Name];
Probably will have to put on either Time and Hours or footer on same and
then
The rest of the code will be on the main form TimeCards using a unbound
textbox using the values
of the Time and Hours form
I can send a small demo db if necessary.
Van T. Dinh said:
OK, much better picture in my head but please post the SQL String (of the
Query) being used as the RecordSource for the Subform [Time and Hours].
Also advise where you intend to use / place the result of the DCount().
--
HTH
Van T. Dinh
MVP (Access)
Dave Elliott said:
The Db is a Invoice db. it calculates the material, labor and the suggested
price to Invoice.
The main form TimeCards has as it's recordsource the query QDates using the
table Time
The sub-form named Time and Hours uses the query Time_Hours with 3 tables
Hours;Employees;TEmpOrCon
Sub-form is tied to main via master/child relationship of TimeID in the Time
table
Sub-form Time and Hours calculates the labor by Rate/Hours Total pay for the
day and grand total pay for the record
as well as overtime rate/ overtime pay...it shows the day worked by date and
also by Day, i.e. Friday
The calculations are already in place for the time / hours, this works fine.
Just need to calculate if more than 2 employees work on any given record on
the sub-form that is one record via the main form.
Example: 3 employees work on Friday, then the rate would be $65.00 an
hour
for the first 2 men, then 32.50 or 1/2 the rate for every employee after
that.
Total Invoiced for hours being (4) for all employees: $390.00
So the count of DAYS (On The Same Day) where the count of
EMPLOYEES
is over 3 needs to be found for the calculation to take place.
Hope this explains better.