Time Table

I need to make a time sheet from Call History.
Basically Filter Employee and pick first call and last call time and create hours of work time.
Please advise.
Hiroyuki TamuraField EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Select DateValue([Call Start Time]) as CallDate, Min([Call Start Time]) As CallStart, Max([Call End Time]) As CallEnd
From YourTable  Where [Call Start Time] >= PeriodStart and [Call End Time] < PeriodEnd +1
Group By DateValue([Call Start Time])

Save this query and call it qCallBase.  Then create a second query to calculate.  You can do the calculation in the first query but it just makes the expression more complicated.

Select *, DateDiff("n", CallStart, CallEnd) As CallMinutes
from qCallBase;

You can then convert minutes to hours and a fraction or hours and minutes, which ever works best for you.
Hiroyuki TamuraField EngineerAuthor Commented:
is this the way?
No.  You either need to create the two queries as I suggested where the second query refers to the first query rather than to the table OR the calculation need to refer to the Min(Call Start Time]) and Max([Call End Time]) fields.  The nested queries make the calculations neater and easier to read but otherwise aren't needed.
Andy CownieImplementation SpecialistCommented:
Assuming you have the agent's name in this same table, something similar to this should work (i have  a very similar example of this).

SQL for query:
SELECT [Call Log].[Agent Name], DateValue([Call Start Time]) AS Date, Min(TimeValue([Call Start Time])) AS StartTime, Max(TimeValue([Call End Time])) AS EndTime, DateDiff("n",[StartTime],[EndTime]) AS [Minutes Worked]
FROM [Call Log]
GROUP BY [Call Log].[Agent Name], DateValue([Call Start Time]);

Open in new window

This will give you a query result showing the agent, date, first start time that day, last end time that day, and the number of minutes between the start of first and end of last calls.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hiroyuki TamuraField EngineerAuthor Commented:
thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.