Results 1 to 3 of 3
  1. #1
    ZodiacPilot is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Location
    Dayton, Nevada
    Posts
    28

    Create two separate record counts from values for a particular field

    I have a report that shows records listing the types of darting performed on a horse. I am trying to create a separate count of records that contain the value "B" and the records that do not contain the value "B".




    Report field: Action
    Horse 1 B
    Horse 2 B
    Horse 3 P
    Horse 4 P
    Horse 5 B


    Totals: B count: 3 P count: 2

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Try:

    SELECT Sum(IIf([Action]="B",1,0)) AS CountB, Sum(IIf([Action]<>"B",1,0)) AS CountOther FROM table;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ZodiacPilot is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Location
    Dayton, Nevada
    Posts
    28
    Thank you very much. You nailed it!

    Resolved

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

Similar Threads

  1. Create a new field that counts another field
    By rockell333 in forum Access
    Replies: 4
    Last Post: 10-01-2015, 07:56 AM
  2. Replies: 13
    Last Post: 12-23-2013, 09:20 AM
  3. Replies: 10
    Last Post: 07-19-2013, 02:05 PM
  4. Replies: 1
    Last Post: 05-09-2012, 02:22 PM
  5. Overtype values and create new record
    By Marnhullman in forum Access
    Replies: 1
    Last Post: 02-09-2012, 12:06 PM

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