Results 1 to 6 of 6
  1. #1
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93

    Count occurences of text in a query

    Hi,


    I am running a totals report from a couple different tables. Most of my data is numeric, which is easy to total, but one of the totals I need is text. The text is called Sight Action, which for each entry the users would make, they would choose from a list that includes Sight Action amongst other choices. I need to be able to total up how may times in a month, the option Sight Action had been chosen. The table is called tblCallType, with Radio Call, Sight Action, Assist, and N/A as option. When the user enters a record, they have to pick one of these options. The only one I need to report on is Sight Action, but I cant figure out how to total that in a query. For example, if the user enters 100 records for the month of February, and 25 of those records were marked with Sight Action, I need 25 to show on the report. I tried the Count function, but it returns a number that isnt the total and I cant figure out what it could be totaling. Any help would be greatly appreciated.

  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,641
    Try

    Sum(IIf(FieldName = "Sight Action", 1,0))

    You could also use a DCount() in the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Hi, thanks for the reply. I think more what I am trying to do is total the amount fo times Sight Action has been selected and put that total in a report. I have my query built which has all of the totals for the numeric data I need. I know how to build the query, but is it possible for this specific field, to just total the amount of time Sight Action is entered?

  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,641
    Yes, I know. Did you try it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    I did try it but I get an error. Do I just put it in a new column in the query?
    Thats what I tried and I get an "The expression you entered contains an invalid syntax."
    This is what I used in a new column,
    SightAction: Sum(IIf(Call Type = "Sight Action", 1,0))

  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,641
    Because of the inadvisable space, you need to bracket the field name.
    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. Count IF Text Box for Dashboard
    By jvlajcic in forum Reports
    Replies: 1
    Last Post: 12-16-2011, 04:37 PM
  2. Count Text as Number
    By AccessFreak in forum Forms
    Replies: 1
    Last Post: 01-04-2011, 12:49 PM
  3. Counting text occurences
    By katie_88 in forum Queries
    Replies: 3
    Last Post: 07-19-2010, 10:46 AM
  4. How to count charcter or text in field
    By nshaikh in forum Queries
    Replies: 3
    Last Post: 09-12-2008, 10:27 AM
  5. Need Help counting occurences
    By anyoder in forum Queries
    Replies: 0
    Last Post: 03-09-2007, 08:53 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