Results 1 to 7 of 7
  1. #1
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186

    Query results from two tables in one field

    Hello everyone
    I have a question regarding about the structure of a query

    I have two tables named "Corrective_Actions_tbl" (Fields: ID, Action_txt, Date_Cor, Responsible, Type) and "Containment_Actions_tbl" (Fields: ID, Action_txt, Date_Con, Responsible, Type) each one with the same structure but feeded by different forms

    I want to make a general query that contains the results from both



    Example in the query:

    ID (From table 1 and table 2)
    Action_txt (From table 1 and table 2)

    and continue in that way

    How should it be structured in the query?

    Thanks in advance for the support!!

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Are the fields related in a specific way or are you just looking to get the rows of both tables in one query?

    https://support.microsoft.com/en-us/...0-ad0a75541c6e

    https://support.microsoft.com/en-us/...1-07061a1478f6

  3. #3
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Just I want to look the rows of both tables in one query, exactly like this

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    As shown in the first link use a union query:

    Code:
    SELECT ID, Action_txt, Date_Cor As ActionDate, Responsible, Type, "Corrective_Actions_tbl" As SourceTable FROM Corrective_Actions_tbl
    Union
    SELECT ID, Action_txt, Date_Con As ActionDate, Responsible, Type, "Containment_Actions_tbl" As SourceTable FROM Containment_Actions_tbl;
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    charly.csh is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Nov 2014
    Posts
    186
    Hi Gicu
    That's exactly what I was looking for!
    Just quick question... I am also trying to update data from this query and I cannot write any update any reason why? or how can I fix this?

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    union queries are not updateable.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    I don't know anything about your app so there may be good reasons for the structure you have but I would consider stepping back a bit. Combine both tables into one and include an extra column to identify each record as corrective or containment

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

Similar Threads

  1. LIMITING Query results from multiple tables
    By moneypennie21 in forum Queries
    Replies: 8
    Last Post: 07-18-2017, 06:36 AM
  2. Replies: 2
    Last Post: 10-07-2015, 11:23 PM
  3. Replies: 1
    Last Post: 07-09-2014, 01:27 PM
  4. Single Query - Results from Three Tables
    By maxx102 in forum Queries
    Replies: 7
    Last Post: 07-09-2013, 08:36 AM
  5. Replies: 12
    Last Post: 12-17-2010, 05:35 PM

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