Results 1 to 5 of 5
  1. #1
    tsn.s is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Location
    Selby, North Yorkshire, UK
    Posts
    19

    Count of Certain Values In a Field

    Hi. I am trying to get a totals column of a field called 'withdrawn_type'. This field can have two different values in it which are 'On Programme' and 'No Show'. I only want to count how many 'No Show' Values there are but I cant seem to get it to work. This is what I have: No Show: Sum(IIf([withdrawn_type]="No Show",0))

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Note that the IIF statement has three arguments (condition, what to return if True, what to return if False). You only have two.
    Maybe
    Sum(IIf([withdrawn_type]="No Show",1,0))

  3. #3
    tsn.s is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Location
    Selby, North Yorkshire, UK
    Posts
    19
    Thanks for the help JoeM. Unfortunately it did not work. A dialogue box pops up when a run the query asking what value I want in the field. If I put 'No Show' in the box it comes back with numbers that a way out.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Have you placed criteria on this field in your underlying query?
    If not, and a dialogue box is asking you to enter a value for [withdrawn_type], it usually means that it does not recognize that field name (you may have a typo in your field name or are trying to use a field which isn't in your report).

  5. #5
    tsn.s is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Location
    Selby, North Yorkshire, UK
    Posts
    19
    It's working now. There was a typo in my field name. It was actually called [withdraw_type] not [withdrawn_type]. Can't believe I didn't notice that! Thanks for your help, it's much appreciated.

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

Similar Threads

  1. 3 values in 1 Column - Get Count of Each Value
    By Ghoztrider in forum Queries
    Replies: 1
    Last Post: 01-09-2012, 03:26 PM
  2. Count() and Null Values
    By jpvonhemel in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 03:37 AM
  3. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 AM
  4. Count Field Values.
    By Cined in forum Access
    Replies: 3
    Last Post: 03-03-2011, 03:21 AM
  5. Count of Unique Values
    By vsmk in forum Queries
    Replies: 2
    Last Post: 03-14-2010, 12:07 AM

Tags for this Thread

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