Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2018
    Posts
    4

    Wink Joining a Union

    Hi guys!

    Basically, I'm trying to make a list of employees' and their managers' email addresses (along with some other information). The problem is, my boss doesn't want any contractors included unless they are managers. It's a long story as to why, but I've determined the best way to make this list is the following structure:

    ((Query 1 list of employees
    Union
    (Query 2 list of contractors
    Right Join
    Query 3 list of managers (use to generate contractors who are managers)))
    Left Join
    Query 4
    list of managers (use to generate list of employees and some contractors with their managers))
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    The Union by itself works fine:
    (Query 1 list of employees
    Union
    (Query 2 list of contractors
    Right Join
    Query 3 list of managers (use to generate contractors who are managers)))
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    And if you Join Query 1 with Query 4, it works fine:


    (Query 1 list of employees
    Right Join
    Query 4
    list of managers (use to generate list of employees and some contractors with their managers))

    but I as soon as I try to join the union, I get an error for the JOIN clause, and Access highlights my UNION operator.

    Does anyone know what might be up? I can provide the code if that helps, but there's kind of a lot of it.

    Thank you!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Can you show us the design of your tables?

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Can you roll back to the beginning
    Are your employees/contractors & managers in one table or 3 tables?
    If one table then you should be able to get what you want by filtering
    If 3 tables, how are the tables linked?

    You will need to provide the structure of your tables/queries for anyone to advise properly otherwise all anyone can do is GUESS
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Joining
    By Perfac in forum Queries
    Replies: 7
    Last Post: 03-03-2018, 06:03 AM
  2. Replies: 4
    Last Post: 08-09-2017, 12:06 PM
  3. Convert Union Query to non-union help
    By Ekhart in forum Queries
    Replies: 2
    Last Post: 01-10-2017, 03:39 AM
  4. Replies: 4
    Last Post: 12-20-2015, 02:35 PM
  5. joining on two userid's
    By svcghost in forum Queries
    Replies: 9
    Last Post: 09-30-2010, 06:48 PM

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