Results 1 to 6 of 6
  1. #1
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33

    Count number of defects per category

    Can't seem to find the answer myself, so I'll ask the pro's once again.

    I have a table where instances of defects on manufactured parts are logged. I would like to create a query, and subsequently a Pivot Chart, that shows the number of instances for a particular type of defect.

    (Example) Query would return:



    Burrs : 2 (instances)
    Damage : 2 (instances)
    Dimensional : 4 (instances)
    Surface Finish : 1 (instance)

    I've attached a screenshot of the dataview of my query. Is this enough to go on or do you need more info? I tried messing with Total / Count but don't quite get it yet. Right now, all I'm able to do is count the total number of rows but cannot separate the totals by category?

    Can you point me in the right direction?

    Thanks.

    Attachment 6238
    Last edited by HeadGasket; 02-10-2012 at 04:00 PM. Reason: Solved

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try

    SELECT NCCategory, Count(NCCategory) AS HowMany
    FROM TableName
    GROUP BY NCCategory
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    Thanks, but I'm still a total rookie and don't quite understand. This is SQL code? Do I put this into the query in design mode, or something else? I'm a little familiar with code when working with forms but I don't know much about queries just yet?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    It is SQL, it would go into SQL view. If you want to use design view, start a new query and choose the category twice. Click on the totals icon and change the Group By to Count for one of them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    HeadGasket's Avatar
    HeadGasket is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2011
    Location
    Sonoma County, Northern California
    Posts
    33
    Doh! Almost smashed my head on my desk when I saw your reply. I had completely forgot about viewing the query in SQL mode. Thanks. I appreciate the help.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2011, 01:54 PM
  2. Count Number of People Per Product
    By Lorlai in forum Queries
    Replies: 3
    Last Post: 06-29-2011, 06:15 PM
  3. count the number of records from a query
    By Nixx1401 in forum Queries
    Replies: 4
    Last Post: 05-24-2011, 06:45 PM
  4. Count Text as Number
    By AccessFreak in forum Forms
    Replies: 1
    Last Post: 01-04-2011, 12:49 PM
  5. Count number of identical posts
    By Patience in forum Access
    Replies: 1
    Last Post: 06-16-2010, 04:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums