Results 1 to 4 of 4
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question First Emp Associated with Record

    I have a dilemma that is driving me a little crazy...

    I have records with ID numbers associated. The ID number can occur in the table multiple times and the Employee associated with that ID number could be different for each occurance of the ID number. What I want is the first employee associated with that ID number and that is it.

    Example:

    IDNum Employee
    1234 John Smith
    1234 Ann Jones
    5678 Bobby James
    5678 Joe Cool

    Values Returned:

    IDNum Employee
    1234 John Smith
    5678 Bobby James

    The problem I am running into is the employee name is coming from one table, the IDNum is coming from another table and I have a third table that houses the employee phone number. In that regard I cannot do a simple "first" criteria.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Your logic if so strange. what was the IDnum design for? it can not identify anything.

    Yes need sub queries to use the "first" function.
    Query1: firstEmployee
    select IDnum, first(table1.employee) as employee from table1 group by idnum.

    Query2: other information
    select firstEmployee.IDnum, firstEmployee.employee ... from firstEmployee,table2,tabl3 where firstEmployee.employee=table2.employee and firstEmployee.employee=table3.employee

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    the data needs to be normalized jg. the setup you have will not work in the long run. if you have time, i would suggest changing it up to match a 3-dimensional layout. gl!

  4. #4
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Thanks for your input. Yes, the way I explained it my logic was very screwy and I apologize. I actually figured out a very simple way to isolate the userid through a separate query.

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

Similar Threads

  1. If duplicate record, go to original record
    By BigBear in forum Forms
    Replies: 2
    Last Post: 10-06-2010, 02:58 AM
  2. Replies: 5
    Last Post: 06-29-2010, 01:24 PM
  3. If duplicate record, go to original record
    By islandboy in forum Access
    Replies: 51
    Last Post: 06-02-2010, 04:17 PM
  4. Replies: 3
    Last Post: 06-27-2009, 03:53 PM
  5. Deleting Record Contents, not complete record...
    By Charles Waters in forum Access
    Replies: 2
    Last Post: 06-24-2008, 12:00 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