Results 1 to 11 of 11
  1. #1
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66

    Exclamation Sum Records With Text

    I have a form with a combo box in it. The combo box has 3 items. Completed, In Progress, Incomplete. A user completes the form and access puts the information in the database. How do i do a query that gives me how many "Completes" a user has or "Incompletes"?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You haven't told us anything about your tables.

    Let's suppose you have a tblWorkOrders, since you didn't give us any info, and suppose for each WorkOrder you could have WorkOrderStatus of any of
    InProgress
    , Completed
    , InCompleted
    Try this as a template for your query
    Code:
    Select WorkOrderStatus, Count(WorkOrder) from TblWorkOrders
    Group By WorkOrderStatus;

  3. #3
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    GSTDtbl is my table. I have 5 combo boxes named RootStatus1, RootStatus2... RootStatus5. Each of these RootStatus combo boxes have incomplete, completed, In Progress. They are stored in the field of the table named RootStatus1, RootStatus2... I am trying to sum up all of the "Completed" and "Incomplete" and "In Progress" of all of these fields for each user. The code you provided works good for one RootStatus, but I need it to encompass all of the RootStatus boxes.

  4. #4
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    I guess I could write 5 different queries. If I go that route, how do I combine those 5 queries into one query summing up the fields that I summed up in the other queries? Which way would be easier? Writing one query that does all of the RootStatus boxes or just combining the separate queries?

  5. #5
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    Nevermind, I think I found the answer. A union query. Thanks for your help.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I would not recommend using Lookups (combobox) at the table field level.

    Lookup tables, referenced via combo boxes (and list boxes) in forms is the
    preferred method of handling lookups.

  7. #7
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    I do not have combo boxes in the table themselves just on the forms.

  8. #8
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    <SELECT GSTDtbl.RootStatus1, Count(GSTDtbl.RootStatus1) AS CountOfRootStatus1, GSTDtbl.RootStatus2, Count(GSTDtbl.RootStatus2) AS CountofRootStatus2, GSTDtbl.RootStatus3, Count(GSTDtbl.RootStatus3) AS CountofRootStatus3, GSTDtbl.RootStatus4, Count(GSTDtbl.RootStatus4) AS CountofRootStatus4, GSTDtbl.RootStatus5, Count(GSTDtbl.RootStatus5) AS CountofRootStatus5
    FROM GSTDtbl
    GROUP BY GSTDtbl.RootStatus1, GSTDtbl.RootStatus2, GSTDtbl.RootStatus3, GSTDtbl.RootStatus4, GSTDtbl.RootStatus5;>

    For some reason this query doesn't add the items. For example it has completed 1 completed 1 under RootStatus1 instead of having completed 2. Individual queries work but when I add them all, it doesn't add the items.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    That part wasn't clear. Do you have your query working?
    Why do you have
    I have 5 combo boxes named RootStatus1, RootStatus2... RootStatus5. Each of these RootStatus combo boxes have incomplete, completed, In Progress. They are stored in the field of the table named RootStatus1, RootStatus2...

  10. #10
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    I have my query that does RootStatus1 working and I can get it to work with all of the others but when I combine them, it doesn't add the items. The reason why I have 5 combo boxes is that the user has to put 5 RootCause statements and each RootStatus is for each RootCause statement.

  11. #11
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    Posts
    66
    Figured it out. I will mark as solved.

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

Similar Threads

  1. Replies: 2
    Last Post: 02-19-2013, 10:36 AM
  2. Replies: 11
    Last Post: 11-12-2012, 06:33 AM
  3. Clear a form text box when user changes records
    By Artist.Anon in forum Forms
    Replies: 4
    Last Post: 08-19-2012, 07:53 PM
  4. Form text box updates for all records
    By AndrewsPanda in forum Forms
    Replies: 13
    Last Post: 09-28-2011, 11:31 PM
  5. How to add text data from records
    By er_manojbisht in forum Reports
    Replies: 3
    Last Post: 03-01-2010, 08:37 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