Results 1 to 2 of 2
  1. #1
    karusya is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    1

    Criteria based on value in another field

    Hello,



    I have a query in Access with the following fields (grouped):

    "Name" "Facility" "Number of Visits"

    I want to limit the query to only pull those names that have at least one visit to a specific facility (let's say facility "A"), but I also need to see all of the other facilities that those who visited Facility A visited. So in this case "= "A"" in the criteria section of the Facility field wouldn't work. I think I need to plug something in the criteria section under the Name field, but I am not sure what.

    Thanks for your help!

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    like you need a SubQuery!

    Make a Query that shows you a list of of everyone that visited facility A.

    Then Make a Query that shows you a list of all the facilities visited by Visitor B.

    Then stick 'em together! You'll probably end up with something like so:
    Code:
    SELECT
      *
    FROM
      Visits
    WHERE
      Visitor IN 
      (
        SELECT
          Visitor
        FROM 
          Visits
        WHERE 
          Facility="Facility A"
      );

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

Similar Threads

  1. Criteria based on another field
    By jlclark4 in forum Queries
    Replies: 12
    Last Post: 02-14-2012, 12:29 PM
  2. data field in query twice based on criteria
    By sandyg in forum Queries
    Replies: 1
    Last Post: 09-29-2011, 07:47 AM
  3. Replies: 5
    Last Post: 03-06-2011, 10:38 AM
  4. Replies: 4
    Last Post: 01-19-2010, 05:36 AM
  5. query - criteria based on another row field value
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 05-29-2009, 04:17 PM

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