Solved

MS Access get count of incidents each hour of day

Posted on 2016-09-03
6
38 Views
Last Modified: 2016-09-03
Dear Experts,

Okay...need some help with this one. I am trying to graph the number of incidents within each hour.

The image below shows my query as it is now. I can group the times but what the users want to see is what time during the day do more incidents occur. For example between 9:00am and 10:00am there were eight incidents and between 10:00am and 11:00am there were 3 incidents. I only need to track from 7:00am until 4:00pm each day.
screenshotscreenshot1Is this possible if and so how do I set my query up?

Thanks!
0
Comment
Question by:shogun5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:shogun5
ID: 41782855
...and when I add the date and sort....
screenshot2
0
 
LVL 48

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 41782927
how about something like:

SELECT stdID, Hour(stdBehaviorTime) as BehHour, Count(ID) as Incidents
FROM tblStudentBehaviors
WHERE Hour(stdBehaviorTime) >= 7 and
AND Hour(stdBehaviorTime) < 16
AND stdID = "12345"
GROUP BY stdID, Hour(stdBehaviorTime)
0
 

Author Comment

by:shogun5
ID: 41782930
Thanks Dale but I am getting this....
screenshotDon't exactly know where the syntax error is....
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 50

Expert Comment

by:Gustav Brock
ID: 41782943
Don't exactly know where the syntax error is....

Are you serious? Read the error message again ("and" again if needed).

/gustav
0
 

Author Closing Comment

by:shogun5
ID: 41782944
Nevermind..found the extra .and.  Thanks again Dale! Worked great!
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 41783077
thanks, Gustav, for the assist.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question