Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2011
    Location
    Sault Ste. Marie, Ontario, Canada
    Posts
    28

    Question Binding 'count' <>1 to appropriate key

    It is I, Captain Database ...!!



    I have a query counting like-results of one field, which is a function of other fields. When I add a key-field, however, it merely counts results as one (there being, quantitatively, one result per every key value). I have thus tried to use one query to list the like-results of different key values, and another to associate their counts (i.e., <>1) with their host-key values. When I try to do so, however, I get an error that I cannot refer to both a table, and a query derived from that table, in the same new query. Doesn't entirely make sense to me, but any suggestions of a work-around?

    Captain Database ...!!
    "When your data calls out for a hero"

  2. #2
    Rhino373 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    65
    This is because when you have a key field, no 2 entries can be the same. This means that when you have a table of lets say 10 items and try to group by that key field you still see 10 items because each entry in the key field is unique and thus its count is also always one.

    Group by the "like results of one field" and then also display the count of that same field.

    So if you have like

    Pie | Apple
    Pie | Cherry
    Pie | Peach
    Drinks | Cola
    Drinks | Water

    You would get

    Pie | 3
    Drinks | 2

    Basically don't group by the ID when asking for counts

  3. #3
    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
    Perhaps you could show us your table structure and the query(ies) you have tried.
    As well you could show us exactly the error message you received.
    Also, if you could describe exactly what you want to achieve using the fields in your table/query, you're more likely to get a meaningful response.

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

Similar Threads

  1. Count is off when using =Count
    By boywonder in forum Programming
    Replies: 3
    Last Post: 06-09-2011, 12:14 PM
  2. GROUP and COUNT?
    By TheMoodyFiles in forum Queries
    Replies: 2
    Last Post: 02-10-2011, 05:50 PM
  3. Binding a Combo Box Search Result
    By cvansickle in forum Forms
    Replies: 2
    Last Post: 12-06-2010, 11:03 AM
  4. Count in Forms
    By ErnieS in forum Forms
    Replies: 13
    Last Post: 05-21-2010, 12:51 PM
  5. binding report field to variable
    By frente in forum Reports
    Replies: 1
    Last Post: 10-19-2009, 02:48 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