Results 1 to 4 of 4
  1. #1
    mimireyes is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    3

    Question Query for 2 Objects

    Hello,

    When I query= In ("Widgets","Gadgets"), I get people that have ordered one or the other, or both.

    I just want people who have ordered both and exclude those that have only purchased one of the two.

    SO...

    Jane: Widgets
    Jane: Widgets
    John: Gadgets
    John: Gadgets
    Rob: Widgets (<-this one I want)
    Rob: Gadgets (<-this one I want)

    Is that possible?

    Thanks in advance!
    Mimi

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Just check out if below gives some guidelines :
    Code:
    SELECT 
        qryA.TheName, 
        Count(qryA.TheItem) AS CountOfTheItem
    FROM 
    (
        SELECT DISTINCT 
            myTable.TheName, 
            myTable.TheItem
        FROM 
            myTable
        WHERE 
            (((myTable.TheItem)="Widgets" Or (myTable.TheItem)="Gadgets"))
    )
    AS qryA
    GROUP BY 
        qryA.TheName
    HAVING 
        (((Count(qryA.TheItem))=2));
    Thanks

  3. #3
    mimireyes is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    3
    I tried a version of this and it worked! Thanks so much.
    Sorry for getting back to you so late.

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662

    Thanks

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

Similar Threads

  1. Saving new Queries (and other objects)
    By afvaiv in forum Access
    Replies: 0
    Last Post: 01-28-2012, 02:11 AM
  2. Objects on the form
    By injanib in forum Forms
    Replies: 2
    Last Post: 03-19-2011, 01:48 AM
  3. Acc97 and OLE objects
    By bnnook in forum Programming
    Replies: 2
    Last Post: 03-17-2011, 01:03 PM
  4. Referring to objects
    By stubbly in forum Programming
    Replies: 1
    Last Post: 10-14-2009, 09:36 AM
  5. query objects in VB6
    By genesis in forum Access
    Replies: 1
    Last Post: 07-10-2009, 02:16 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