Results 1 to 3 of 3
  1. #1
    travisc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    1

    Joining 2 databases

    VERY new to Access.



    I've created relationships between my two databases (WorkCell and EventHistory), linking together Part#, ShiftDateTime, Machine#... which share the same column names and values.

    Here's WorkCell:
    ShiftDateTime Machine # Part # Total Pieces
    12/18/2015 05:45 Press # 01 Skin1 5
    12/18/2015 05:45 Press # 01 Skin1 7
    12/18/2015 05:45 Press # 02 Skin2 3
    12/18/2015 05:45 Press # 02 Skin2 6

    Here's EventHistory
    ShiftDateTime Machine # Part # EventCode Defect Code
    12/18/2015 05:45 Press # 01 Skin1 Scrap Crack
    12/18/2015 05:45 Press # 02 Skin2 Scrap Blister
    12/18/2015 05:45 Press # 02 Skin2 Scrap Nonfill
    12/18/2015 05:45 Press # 02 Skin2 Scrap Blister

    How could I create a query that would return:
    ShiftDateTime Machine # Part # Total Pieces Crack Blister Nonfill
    12/18/2015 05:45 Press # 01 Skin1 12 1 0 0
    12/18/2015 05:45 Press # 02 Skin2 9 0 2 1

    Is this possible? I current have a query with ShiftDateTime/Machine#/Part# linked together... grouping by shiftdatetime/machine#/part# then summing TotalPcs...

    Any help would be greatly appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    2 things,

    1. you say databases, but I think you mean 2 tables in 1 database. (database is the whole encompassing tables, queries, reports, etc)

    2. yes you can join on part and date BUT, ShiftDateTime could be a problem because it uses time. IF ALL records use a permanent shift time of 5:45 then you will be OK.
    If it is a date stamp of working on the machine then it will fail.

    Join the 2 tables to get the fields you want and do a crosstab query to get your above results.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Advise not to use spaces and special characters/punctuation (underscore is exception) in naming convention. Better would be MachineNum or Machine_Num.

    I think you need to do aggregate query to first summarize the data of WorkCell table. Do a Sum([Total Pieces]) aggregate with grouping on Machine, DateTime, Part.

    Build a CROSSTAB on the WorkHistory table with Machine, DateTime, Part as Row criteria. http://allenbrowne.com/ser-67.html

    Now do a query that joins these two queries with compound link on the 3 key fields.
    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. Joining tables help
    By grewpar in forum Access
    Replies: 7
    Last Post: 10-07-2014, 12:11 PM
  2. Joining two tables
    By rspai in forum Queries
    Replies: 7
    Last Post: 05-22-2012, 12:21 AM
  3. help with joining SQL statements
    By iamstupid in forum Queries
    Replies: 2
    Last Post: 05-26-2011, 06:55 AM
  4. joining tables
    By frozendmj in forum Queries
    Replies: 5
    Last Post: 04-19-2011, 01:45 PM
  5. Joining a Query
    By access_gbr in forum Queries
    Replies: 1
    Last Post: 05-04-2010, 10:46 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