473,385 Members | 1,732 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,385 software developers and data experts.

How to calculate the number of working hours each month in a Access query?

77 64KB
Hi All,

I am using MS Access 2010. I am working out each member of staffs working hours for the month in a MS Access query.

[WorkDate]
[TimeIn]
[TimeOut]
minus a 1 hour lunch.

I would like to display the total hours worked for the month in a hours:minutes format.

I tried this approach: -
Call a field WorkHoursPerMin in a query:-.

Expand|Select|Wrap|Line Numbers
  1. WorkHoursPerMin: Sum(DateDiff("n",[timeIn],[timeOut]))
Make a GroupBy query and Sum this field.

For the display I used a second query based on the first where I did the following:

Expand|Select|Wrap|Line Numbers
  1. WorkHoursPerMonth: CDate([WorkHoursPerMin]\60 & ":" & [WorkHoursPerMin] Mod 60)
My idea is to show a column with the month of the year and a second with the number of hours worked in that month.

Your help with this is greatly appreciated.
Jun 30 '16 #1

✓ answered by wirejp

Hi All,

I got the issue resolved:

1st query: -
Expand|Select|Wrap|Line Numbers
  1. WorkHoursPerMin: Sum(DateDiff("n",[timeIn],[timeOut])-60)
2nd query:
Expand|Select|Wrap|Line Numbers
  1. WorkMths: [WorkHoursPerMin]\60 & Format([WorkHoursPerMin] Mod 60,"\:00")

1 2276
wirejp
77 64KB
Hi All,

I got the issue resolved:

1st query: -
Expand|Select|Wrap|Line Numbers
  1. WorkHoursPerMin: Sum(DateDiff("n",[timeIn],[timeOut])-60)
2nd query:
Expand|Select|Wrap|Line Numbers
  1. WorkMths: [WorkHoursPerMin]\60 & Format([WorkHoursPerMin] Mod 60,"\:00")
Jun 30 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Totto | last post by:
Hi, Is ther a simple way to calculate number of hours in a date range. (dtFrom as date , dtTo as date) Had a look at timespan, but can's see that it's possible to add dates. Tnx Totto
8
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
1
by: deena22 | last post by:
hello, i'm using 'Access database' and VB 6.0. My database is named ' timesheet' and it contains a table named 'tabletimesheet'. The table contain the following fields: 'staffname, stafftype,...
12
by: denveromlp | last post by:
Hello, I'm new to Access and trying to calculate a rolling 12 month average from some time data. Each data point is a date and a measurement taken at that date. As far as I can tell, the only...
10
by: Anthony97 | last post by:
This is a problem I've been fighting through for the last month. I've been tasked with converting access 2007 queries to SQL Server 2005. I have been able to convert a number of queries associated...
10
bsmeena7005
by: bsmeena7005 | last post by:
Hi help me to calculate the working hours between 10 to 18 hrs between two dates including the weekends also no braek or lunch time Example :- start date #01-08-2009 08:45:23# end date ...
3
by: shas1928 | last post by:
HI i have one column in a query which give total worked hours in the format like 09:00, 08:53.. How can I sum up all those ...
13
by: brentg | last post by:
I am using Access 2007. I am trying to calculate in an access query the median of six test scores for each student. Some students will not have all scores and the value of the field would be null. ...
6
by: ESAKKI109 | last post by:
In the attached image I was trying to calculate number of working days(throughput) b/w item received_date and item_released date by using datadiff with "w" interval . but if I use "w" interval it...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.