Results 1 to 10 of 10
  1. #1
    pbouk is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    58

    Using a query to filter - too many results

    Hi there,
    I have a Contacts database with a form and combo-boxes that enable my user to filter and create custom lists.
    They're working well, except I would like to fine tune the query the filters are based on.
    I have five search filters (they do not cross filter, only one can be searched at a time)
    Company
    Category
    City
    State
    Country

    Basically, most contacts have one or more addresses and also are categorised by one or more "Category types". eg: Museum, Artist etc.
    What I'm finding is that when I do a search (eg: Texas) it lists each contact in Texas many times, depending on how many addresses and categories it has associated with the name.
    Some contacts are listed four times, because they have two addresses and two category types.



    I'm not sure how to resolve this. Any ideas?
    Query is below, and I removed Categories to see if it made any difference, but it's still listing each contact according to how many categories it's been typed as (as well as by the number of addresses)
    Click image for larger version. 

Name:	QueryFIlter.jpg 
Views:	14 
Size:	59.6 KB 
ID:	11569

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    That is the nature of 1-to-many related data.

    What is the query used for? Is it the basis for a report?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    pbouk is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    58
    Yes, a report or a mailing list.
    Will my user have to sort through it to remove the duplicates or is there another way to handle it?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    That's what happens when you include multiple 'many' tables in the same query. Constraining the recordset to prevent multiple mailings to the same contact probably won't be easy. Will the mailing be to all contacts? Or only to contacts within a selected category? What should determine which address to use?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    pbouk is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    58
    Thanks, yes, I'll need to restrict the data to a mailing address I think.
    I'm having the same problem with my multi-search box.

    Is there any way to get the data base to search all addresses but only list the address types I specify?

    thanks again

  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,742
    Yes, but it starts with table design, normalization and relationships.
    Why are there duplicates?

  7. #7
    pbouk is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    58
    Pretty sure my table design is ok. They're not duplicates, just repeats of the same info with the category/address fields field info different. So if there are two addresses and two categories for a contact, the contact appears four times.
    I have a filter for making lists, and it won't be used that much and the record set is small, so it's not really such a big deal, but it is important for my keyword multi search.
    Each of the results that come up can be clicked on and the user goes to the form where all the info resides. What I'd like is that the DB searches everything but only shows the mailing or Business or Home address (not all contacts have a mailing address).
    Then, maybe I could add another search box for Categories, where the user could choose a particular category as well to further restrict the search.

    Would that work?

  8. #8
    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,742
    Can you post a copy of your database - remove anything confidential - to show the specific issue?
    And tell us specifically what we should look for.

    Or you could give us a sample or two using some of your data.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Seems that query you already have will afford that search. Just have to be aware that unfiltered dataset will show repetition of contact name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    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,742
    Seems June7 understands your situation and is helping -- so I will bow out.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  2. Replies: 1
    Last Post: 04-12-2012, 11:34 AM
  3. Look Up Tables and Filter Results
    By starkeymd in forum Access
    Replies: 1
    Last Post: 01-12-2012, 04:17 PM
  4. Replies: 9
    Last Post: 12-11-2011, 07:16 PM
  5. cbo to filter results from a query
    By nianko in forum Forms
    Replies: 5
    Last Post: 08-18-2010, 09:43 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