Access Help calculating weekly total hour worked (1 Viewer)

priyeshG

New member
Local time
Today, 09:21
Joined
Apr 12, 2022
Messages
1
Hi,
I'm trying to create a employee payroll system. I have log hour table which keeps record of clock in and clock out. I'm able to create total hour worked by each employee by calculating all times from the log hour table associate to each employee. I have payperiod table which have start date and end date attribute. Therefore, I want to be able to just calculate hour worked for that payperiod range. Right now total hour in query sums all the log hour from loghour table for each employee.
Can someone help me with this. I'm newbie to Access.
 

Jon

Access World Site Owner
Staff member
Local time
Today, 14:21
Joined
Sep 28, 1999
Messages
7,312
Welcome to the forums! We are the most active Microsoft Access community on the internet by far, with posts going back over 20 years!

To get started, I highly recommend you read the post below. It contains important information for all new users to this forum.

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We look forward to having you around here, learning stuff and having fun!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:21
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF!

I suggest you post your questions in the appropriate forums.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:21
Joined
May 7, 2009
Messages
19,175
create first a Query that will extract the [start date] and [end date] from your payperiod table:

(Query1)
select [start date], [end date] from payperiod where [start date] = dmax("[start date]", "payperiod");

next create another query that will total your table and will use Query1 (above):

select [employeeid], sum(datediff("h",[log in], [log out])) as TotalHours
from [loghour table]
where [log date] between dlookup("[start date]", "Query1") And dlookup("[end date]", "Query1")
group by [employeeid]
 

Users who are viewing this thread

Top Bottom