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

Need help substracting 1

Status
Not open for further replies.

allong

Technical User
May 2, 2003
40
US
Hello everyone. In my report I need to a field that will show me all hours over 40. I not quite sure how it is done.
 
Can you elaborate on that? Do you want your report to show only records where the hours field is greater than 40????

Need some more info.

Fred
 
I'm sorry Fred. I need to get the hours over 40. In other words My work week is 40 hours. Everything over 40 is overtime. I am trying to calculate overtime hours for each individual with more than 40 week.
 
The query that is the source of your report, can you give me the fields that are in that query - Then we can work something out - thanks!!!

Fred
 
Good afternoon Fred, here are the fields:

EmployeeName;EmployeeID;CustomerName;CustomerID;ScheduleDate;StartTime;EndTime;CostCenter;PayRate;TotalHrs;OvertimeHrs.
 
What kind of expression do you have in your OvertimeHrs criteria?

Try this not in your query, but in the form as a text box

= Sum ( [PayRate]*[TotalHrs]*1.5)

A shot in the dark but see how that turns out.
 
OvertimeHrs can be a calculated control in your report. Add an unbound text box and set its control source to something like this:
Code:
IIf([TotalHrs] > 40,[TotalHrs] - 40, 0)
 
CosmoKramers suggestion is on the mark. However, I would put the criteria in the query so I could sort on it.

I would add these two fields to your query:

Regular Hours: IIf([totalhours]<40,[totalhours],40)

Overtime Hours: IIf([totalhours]>40,([totalhours]-40),0)

Now you have the two fields that actually total to the correct number of hours

This works fine for me and I can sort by these new fields (for example, sort the report by most overtime hours in descending order.

Hope that makes sense.

Fred
 
Thanks everyone. Great job. Report working very well. Did not know what to do until you gave me the answer. So long for now and have a wonderful day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top