Results 1 to 4 of 4
  1. #1
    SealM is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    40

    Help with COUNTIFS Totaling Text Fields in an UPDATE QUERY

    I haven't found a good source for this information, so I thought I would ask here. I have a list of text boxes that may contain text, or may not. I just want a number field that totals the text boxes that have text in them and give a count.

    For instance, I have the text fields text1,text1, and text3. And a number field called textboxcount

    If there is text in text1 and text3, then textboxcount would = 2

    Any help would be appreciated! Thanks!

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    COUNTIF is not an Access command or native function.

    Can you provide more info about your database, tables,form?

  3. #3
    SealM is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    40
    Sure thing. This is for ONE table. There are actually 6 text fields that have various text in them (or they can be blank) There's actually text in them when a flagged item appears.. this detail is not really important, but basically all I want to do is make a count of all the "flags" that appear in each record. And a flag is made by there being text in one of these boxes.

    In excel, it was no big deal, but here in Access, I don't know what the SQL would be to sum the text fields that have text in them.

  4. #4
    SealM is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    40
    Okay, I found the solution I needed. I was thinking too hard about this obviously. But it brings up another problem I have, which someone may help with. I just updated the count by using a WHERE statement. Now, I since I have 6 text boxes that COULD have data in them, I have to make a query that updates the count for each one. Can someone tell me a way to combine these two queries?

    Here's the first one, which just puts a 1 in the [total.flags] field if there is the specified text in the first field:
    UPDATE Raw SET Raw.total_flags = 1
    WHERE [call_on_weekend]="Call on Weekend, ";

    Now, here's the second one I created, which adds 1 if the 2nd box has the specified text in it:
    UPDATE Raw SET Raw.total_flags = total_flags+1
    WHERE [call_after_6pm]="Call after 6PM,";

    They both work great, but I would LOOOOVE to combine these two queries so that one query would do both. If I can do this, then I can add the other 4 in here, and make it do what I had originally wanted to do in the first place! Yay! hehe

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

Similar Threads

  1. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  2. Running totaling with a query
    By tttccc in forum Queries
    Replies: 1
    Last Post: 03-28-2012, 09:37 AM
  3. UPDATE query with many fields
    By Deutz in forum Queries
    Replies: 7
    Last Post: 08-23-2011, 05:53 PM
  4. Update Two fields (text boxes) Form
    By j2curtis64 in forum Forms
    Replies: 11
    Last Post: 07-06-2011, 08:43 AM
  5. Basic Query/totaling fields in a query
    By afisher in forum Queries
    Replies: 6
    Last Post: 08-05-2010, 01:43 PM

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