Results 1 to 2 of 2
  1. #1
    robincross224 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    1

    Question Query which does not show records which appear in another query

    Hi there,
    I'm a bit of a novice when it comes to Microsoft Access, and I have a problem which has had me confused all day.



    I have a database which pairs customers' records with the services they receive- there are three tables to do this:

    TCustomer
    TService
    TServicebyCustomer

    The TServicebyCustomer table has two fields, the key from TCustomer and the key from TService. Here is some Example data:

    1, A
    1, B
    2, B
    3, A
    4, B
    4, A

    I need to create a list of people who haven't received Service A but have received Service B. The problem is with a query, If I filter records to show those with Service B it will show me those with service B but not If they have Service A or not.... for example- it would filter out customers 1, 2 and 4 but because each link is made in a different record, I would have no idea if that person had A, as it is made in a separate record.

    I have made a query which shows those who have received service A, could I use the results of that query to filter out records from another Query???

    I have no idea where to start, please help!!

    I

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    How many service codes are possible?

    Create a crosstab query with the Query Wizard. The TServicebyCustomer table will need a unique ID field, an Autonumber will serve.
    TRANSFORM Count([ID]) AS CountOfID
    SELECT [Customer], Count([ID]) AS [Total Of ID]
    FROM TServicebyCustomer
    WHERE [Service])="A" Or [Service]="B"
    GROUP BY [Customer]
    PIVOT [Service];

    This will create columns for Service codes. Now query the crosstab for records that don't have count in Service A but do have Service B.
    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.

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

Similar Threads

  1. How to not show duplicate records in query?
    By JimmD43 in forum Queries
    Replies: 3
    Last Post: 05-29-2011, 02:54 PM
  2. show name of query in query field
    By lmnnt in forum Queries
    Replies: 2
    Last Post: 05-24-2011, 08:01 PM
  3. Query to show only specific records
    By CEV in forum Queries
    Replies: 5
    Last Post: 03-30-2011, 09:42 AM
  4. Query, show top 10
    By lostinspace in forum Queries
    Replies: 4
    Last Post: 05-10-2010, 12:18 PM
  5. Query to only show a value in a form from a query
    By cwwaicw311 in forum Queries
    Replies: 28
    Last Post: 03-27-2010, 02:31 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