Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2015
    Posts
    2

    Unanswered: Creating a query based upon matching part of a primary key

    Hi All

    I am using MS Access 2003 and have a question. I haven't used Access in many years so my knowledge is a little rusty.

    In Table 1 I have various fields including one named Reference which acts as the primary key. An example of a reference would be ABC-ZZZ.123-12345

    The initials before the first hyphen, in this case ABC, relate to a specific individual. These initial letters are unique and usually 3 or 4 characters long.

    In Table 2 I have a list of the initials and the name of the individual to which they relate. E.g.

    Initials | Name

    ABC | Arnold
    XYZ | Donald
    DEF | Gertrude
    AAA | Gilbert


    How can I create a query so that it will lookup the name of the individual in Table 2 based upon the initials in the reference in Table 1?

    Using the above example this should display:

    Reference | Name
    ABC-ZZZ.123-12345 | Arnold

    Is this possible?

    I would really appreciate your thoughts,

    Russel

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Use a join,something like
    Code:
    select my, column, list, table2.name from table1
    Join table2 on left (table1.myreferencecolumn,3) = table2.initials
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2015
    Posts
    2
    Quote Originally Posted by healdem View Post
    Use a join,something like
    Code:
    select my, column, list, table2.name from table1
    Join table2 on left (table1.myreferencecolumn,3) = table2.initials
    Hi Healdem

    Managed to figure it out in the end, many thanks for your help!

    Russel
    Last edited by Roamr; 02-09-15 at 20:13.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •