473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with and Regular vs Overtime Query

I am having trouble bellow wit this query. I have the total regular hours and the overtime. The problem is that if it is 8 hours and under, I need it to show as regular hours. Any thoughts?

SELECT [EPT Regular Time Total Daily Query].[Employee Name], [EPT Regular Time Total Daily Query].Date, [EPT Regular Time Total Daily Query].[Sum Of Total Regular Time], IIf([Sum Of Total Regular Time]<=8,[TotalHours],8) AS [Regular Hours], Sum(([Sum Of Total Regular Time]-[Regular Hours])) AS Ot
FROM [EPT Regular Time Total Daily Query]
GROUP BY [EPT Regular Time Total Daily Query].[Employee Name], [EPT Regular Time Total Daily Query].Date, [EPT Regular Time Total Daily Query].[Sum Of Total Regular Time], IIf([Sum Of Total Regular Time]<=8,[TotalHours],8);

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
3 2069
Why not break it into two columns. Calculation in one, text in another.
You can always combine the two values at some later point. (On a form,
or another query).

HTH.

Dave

Nov 13 '05 #2
Still kind of new to this whole access deal. Can you give me some assitance with the code.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #3
Jamie,
Calculate the total hours first. Then use IIf() to calculate regular,
overtime and double time amounts. It's a lot easier if you know to total
hours first. Also, the group by is probably unnecessary.

"Jamie Pittman via AccessMonster.com" <fo***@AccessMonster.com> wrote in
message news:41******************************@AccessMonste r.com...
I am having trouble bellow wit this query. I have the total regular hours
and the overtime. The problem is that if it is 8 hours and under, I need
it to show as regular hours. Any thoughts?

SELECT [EPT Regular Time Total Daily Query].[Employee Name], [EPT Regular
Time Total Daily Query].Date, [EPT Regular Time Total Daily Query].[Sum Of
Total Regular Time], IIf([Sum Of Total Regular Time]<=8,[TotalHours],8) AS
[Regular Hours], Sum(([Sum Of Total Regular Time]-[Regular Hours])) AS Ot
FROM [EPT Regular Time Total Daily Query]
GROUP BY [EPT Regular Time Total Daily Query].[Employee Name], [EPT
Regular Time Total Daily Query].Date, [EPT Regular Time Total Daily
Query].[Sum Of Total Regular Time], IIf([Sum Of Total Regular
Time]<=8,[TotalHours],8);

--
Message posted via http://www.accessmonster.com

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Whittaker | last post by:
here's my dilemma, on the program below, i am trying to calculate overtime pay at time and a half, but instead of only counting the hours after 40, it counts all hrs at that rate, how can i avoid...
3
by: Jamie Pittman via AccessMonster.com | last post by:
I am currently working on a project to take an employees time for a day and and if over 8 hours it would move those extra hours to overtime row amd not caculate into regular time. I started to use...
5
by: Jamie Pittman via AccessMonster.com | last post by:
I have two tables with 5000 entries on them. One is based for regular time with several variables example (employee name, date,time in and out, code, customer, building) I have another table that...
0
by: =?Utf-8?B?UGxheWE=?= | last post by:
I am using a print preview dailog in vb .net and when I open the dialog there are multiple pages. Everytime I press the print button only the last page prints. I have tried so many things but...
1
by: alzaabi20xx | last post by:
hello everyone i hope you could help me in this query. i build a query which you give it a month and a year and after it will calculate the overtime of that month (choosen month & year). my...
1
cori25
by: cori25 | last post by:
Employee's input the shifts they want, once I have all this data I need to determine who will get what shifts depending on a reliability %, if thats the same then I look at the time stamp. I have...
7
cori25
by: cori25 | last post by:
I have 4 database's that I need to enter and run a macro in. The macro in each db is named the same. I am having difficulty creating a loop to go into one db run the macro exit and then go into...
6
by: ChipR | last post by:
I need a query to see who worked what hours on activities, and I have combo boxes to narrow the results to a specific activity or employee. I can't figure out how to get the sums of different types...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.