Results 1 to 3 of 3
  1. #1
    ork2002 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2014
    Posts
    11

    I need a function that keeps only like names when comparing two records

    So I have a table of surgical procedures(field = "procedure"), each procedure has a multi-value list of people qualified to perform this procedure (multivalued field = "surgeons").

    In my main table I have a list of patients, each of which may have up to 8 OR procedures performed. Using a join query, I can see a total list of all surgeons that could perform each procedure on a select patient; but I need the opposite of a "select distinct" function in order to display only the surgeons that can perform all the procedures.



    For example: Patient A requires both procedure1 AND procedure2:

    Procedure1: Surgeon1, Surgeon2, Surgeon3
    Procedure2: Surgeon2 only

    I need the opposite of a select distinct function that will show only surgeons who are able to perform both procedures: In this case:
    Patient A; Surgeon 2

    And as I said, this needs to accommodate up to 8 procedures for each patient.

    Any ideas. I am thinking that this will require a user-defined function to accomplish. Thanks!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Most developers will tell you to avoid
    1) multivalued fields
    2) table fields with lookup at the field level

    Build tables:

    Surgeons and Procedures ===> but this will indicate a surgeon can perform Many Procedures and
    A Procedure can be performed by Many Surgeons.
    Many Surgeons can perform Many Procedures
    So you need a linking/mapping/junction table to resolve which Surgeon can perform which Procedures
    Code:
    To resolve/avoid/work with Many ---------->Many relationship, you use a junction table to build
    two (2)   1 to Many relationships.
    
    1-------------------->Many                        Many<------------------------------1
    tblSurgeon --------->tblSurgeonPerformsProcedure<-----------------------tblProcedure
    Watch this video.

  3. #3
    ork2002 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2014
    Posts
    11
    So I have fixed this by using several queries. The first query pulls pulls all the faculty associated with each procedure and counts them, ie

    Patient unique identifier, patient name, Faculty name, Faculty count
    #######, ######, Faculty1, 3

    The second query counts the total number of procedures listed under each patient OR booking. total procedures = 3

    The third query looks at each of the above two queries and keeps only the faculty names who's Facutly count = total procedure count and there it is. A list of all the faculty who can perform all of the individual procedures listed for the OR booking. Solved.

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

Similar Threads

  1. Comparing Columns of numbers with IIf function
    By emspence in forum Queries
    Replies: 7
    Last Post: 02-23-2013, 01:05 AM
  2. Replies: 2
    Last Post: 02-18-2013, 09:58 AM
  3. Function comparing rows
    By Dharmesh in forum Access
    Replies: 1
    Last Post: 10-20-2011, 07:59 AM
  4. Comparing Records in two (2) Tables.
    By RalphJ in forum Programming
    Replies: 19
    Last Post: 04-19-2011, 02:50 AM
  5. Comparing Like Records
    By JSAKelley in forum Queries
    Replies: 0
    Last Post: 04-16-2011, 05:31 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