Results 1 to 4 of 4
  1. #1
    Legal_Eagle is offline Novice
    Windows 11 Access 2021
    Join Date
    Aug 2024
    Posts
    1

    Query: Multiple Columns of Same Field with Different Criteria


    I would like to run a query that has multiple columns of the same field with different criteria.

    My database has a table of employees with different titles (manager and associate). It has a many-to-many relationship to a table of projects using a junction table.

    I'd like a report that lists each project in column 1, each manager assigned to such projects in column 2 and each associate assigned to such projects in column 3.

    What concepts would I use to build the query that feeds into that report? I only know how to filter by one field, but column 2 and column 3 should display names filtered by their titles.

    I'm a lawyer relearning Access after 15 years. This feels like such a basic question and I'm really frustrated trying to solve it. I really appreciate any input or tips you could give. Thanks!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    For clarity- 1 Mgr per project, 1 or Many Assoc per Project? Always good to show readers your Table structure.

    Do you have a structure along these lines?

    Project-->EmployeeRoleOnProject<--Employee


    Project:
    Proj1
    Proj2

    Employee:
    Emp1
    Emp2
    Emp3

    EmployeeRoleOnProject:
    Proj1 Emp1 Mgr
    Proj1 Emp2 Assoc
    Proj2 Emp3 Assoc
    Proj2 Emp2 Mgr

  3. #3
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    You may be over thinking the query part. Reports are better at grouping and sorting, plus they ignore query grouping anyway. Report grouping is usually done by having each group being one under the other, with the pertinent records (or sub groups) within that group. If you are not OK with that, then you may need a report with 1 or 2 subreports which contain the records side by side. If you mocked up something in Excel and copy/paste here it would create a table in your post. That might be useful in deciphering what you need. I agree with Orange that seeing your table relationships (or at least a pic of the tables in your query) might be helpful as well.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    You could create two separate queries (one listing the project ids and the managers, the other the project ids and the associates) and bring those in the third where you'd link on the project ids (probably using outer joins in case not all projects have both types).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Creating a criteria for multiple columns
    By Mrocks22 in forum Queries
    Replies: 2
    Last Post: 06-19-2019, 05:47 PM
  2. Replies: 2
    Last Post: 05-17-2017, 06:17 AM
  3. Replies: 3
    Last Post: 06-21-2013, 09:06 AM
  4. Replies: 7
    Last Post: 01-02-2013, 11:23 PM
  5. Multiple columns from 1 query field
    By top1hat19 in forum Queries
    Replies: 3
    Last Post: 03-11-2011, 03:03 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