need your help with access query

i have a table Data and i am using query Query 1
Name
InspectorName      InsDate               Time
User1                      5/1/2015      00:05
User1                      5/1/2015      00:05
User1                      5/1/2015      00:15
User1                      5/1/2015      02:10
User1                      5/1/2015      00:35
User1                      5/1/2015      01:40
User1                      5/1/2015      00:10
User1                      5/1/2015      00:35
User1                      5/1/2015      00:50
User1                     5/1/2015              00:25
User1                     5/1/2015              00:20
User1                     5/1/2015              00:35
User1                     5/1/2015              00:15
User1                     5/1/2015              00:10
what i need to calculate the total sum of the TIme, in this case it should be 8 hours 10 minutes

something needs to be converted to the right format, since i canot apply the sum to my Time
Roman FAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

omgangIT ManagerCommented:
SELECT tblInspector.InspectorName, tblInspector.InsDate, Sum(DatePart("n",[InsTime])) AS TotalTime
FROM tblInspector
GROUP BY tblInspector.InspectorName, tblInspector.InsDate;


Use the DatePart function.  See example above.

OM Gang
Roman FAuthor Commented:
thank you for your respond

i am having an error when i run the query
SELECT data.InspectorName, data.InsDate, sum(DatePart("n",[duration])
FROM data
group by InspectorName, InsDate
omgangIT ManagerCommented:
What error are you receiving?  Is [duration] column a date/time data type?  The DatePart function works on date/time data types only.
OM Gang
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Roman FAuthor Commented:
you have a database attached, could you look at the database,
omgangIT ManagerCommented:
I don't see it.
Roman FAuthor Commented:
Sorry :)
Test.accdb
Hamed NasrRetired IT ProfessionalCommented:
Try:

SELECT InspectorName      , Sum([Time]*24) AS sumOfTime
FROM Data
GROUP BY InspectorName ;

Open in new window

omgangIT ManagerCommented:
I am receiving no error with your sample database.

Query
SELECT data.InspectorName, data.InsDate, Sum(DatePart("n",[duration])) AS TotalTime
FROM data
GROUP BY data.InspectorName, data.InsDate;

Results
InspectorName      InsDate      TotalTime
User1      5/1/2015      310
User1      5/4/2015      0
User2      5/1/2015      446
User2      5/4/2015      0

OM Gang
Roman FAuthor Commented:
yep, so far is great,
let me check something
Hamed NasrRetired IT ProfessionalCommented:
Applied my comment to your database.
attached.

SELECT data.InspectorName, Sum([duration]*24) AS Expr1
FROM data
GROUP BY data.InspectorName;

Open in new window


Result:
InspectorName      Expr1
User1              16.1666666666667
User2               18.4333333333333
Test-1.accdb
Roman FAuthor Commented:
great, and finally, how to round 8.166666666666666666666 to 8:10???
0:05
0:15
0:35
0:20
0:25
0:50
0:35
0:10
0:05
1:40
0:10
0:35
2:10
0:15
Dale FyeOwner, Developing Solutions LLCCommented:
yourValue = 8.166666666666666666666

Format(8.16666666666, "h:nn:ss")
Gustav BrockCIOCommented:
You should not multiply by 24 but go straight:

SELECT InspectorName, Sum([duration]) AS SumotTime
FROM data
GROUP BY InspectorName;

Then apply the format h:nn to SumOfTime.

/gustav
Roman FAuthor Commented:
none of your last comments are work for you, sorry
Hamed NasrRetired IT ProfessionalCommented:
Try this query: check the attached database.

SELECT Q.InspectorName, Format([expr1],"Short Time") AS theTime
FROM (SELECT data.InspectorName, Sum([duration]*24) AS Expr1 FROM data GROUP BY data.InspectorName)  AS Q;

Open in new window

Test-2.accdb
omgangIT ManagerCommented:
Or this one.
OM Gang

SELECT InspectorName, InsDate, [TotalDuration]\60 & Format([TotalDuration] Mod 60,"\:00") AS Dur
FROM (SELECT data.InspectorName, data.InsDate, Sum(DatePart("n",[duration])) AS TotalDuration
FROM data
GROUP BY data.InspectorName, data.InsDate);

Open in new window

aikimarkCommented:
This is the simplest form I can generate
SELECT InspectorName, InsDate, format(Sum([duration]),"hh:nn") AS TotalTime
FROM data
GROUP BY InspectorName, InsDate;

Open in new window

Gustav BrockCIOCommented:
> none of your last comments are work for you, sorry

It has to work and will do - except if your time field is not of data type Date. If it is Text, convert to Date:

SELECT InspectorName, Sum(CVDate([duration])) AS SumotTime
FROM data
GROUP BY InspectorName;

/gustav

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
Roman FAuthor 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.