Results 1 to 2 of 2
  1. #1
    accessLearn is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2015
    Posts
    11

    Query to combine data from a table and a lookup table

    I have a table A in MS access that gets updated through an access form and form has 3 employeename fields
    and 3 Dept fields
    Emp1, dept1
    Emp2, dept2
    Emp3, dept3
    I have 2 lookup tables:
    Employee table to store employee info with emplid (auto num),name (text) and dept(num)
    Also Dept table with Deptid(autonum) and Dept (text field) for the department info
    I did create Emp1, Emp2 and Emp3 field in table “A” but initially not thought to create associated department but now I want to be able to look at the department as well
    I was thinking to write a query to get the department but unable to join.

    I was thinking
    Select A.*, Employee.dept from A inner join Employee
    On (A.emp1=employee.emplid or A.emp2=employee.emplid or A.emp1=employee.emplid)
    But getting an error that Join expression is not supported.

    How can I do that?



    Thanks,
    Blyzzard

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Multiple similar fields for same type of data is not a normalized data structure.

    You don't use Or in a JOIN clause.

    Use the query designer. Have to pull in the department table 3 times, join 1 of each to 1 of each deptX fields.

    Why do you need deptX fields? Doesn't the employee table have the department employee is assigned to?

    Should save EmployeeID, not employee name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-23-2015, 03:38 PM
  2. Combine data from one table
    By Ray67 in forum Queries
    Replies: 19
    Last Post: 08-04-2014, 07:12 AM
  3. Replies: 11
    Last Post: 01-15-2014, 02:02 PM
  4. Using lookup data for table 1 mutible times in table 2
    By mbjazz in forum Database Design
    Replies: 5
    Last Post: 04-26-2011, 01:18 AM
  5. Combine Query Results to One Table
    By pr4t3ek in forum Queries
    Replies: 0
    Last Post: 12-19-2008, 06:37 AM

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