Results 1 to 7 of 7
  1. #1
    hara is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    4

    Newbie needs help appending table

    Hi there,

    I am brand new here and pretty much a week working with Access. And of course I ran into a problem. I want to combine two tables using Access into one.

    Table 1 has 22,000 records:


    ID; X1; X2; X3; X4; X5; X6; X7; X8

    Table 2 has 2,000 records:
    ID; Y1; Y2; Y3; Y4; Y5

    ID is not the Access ID for records, but a user ID and is the common element. I want to create a new table that would look like this:

    ID; X1; X2; X3; X4; X5; X6; X7; X8; Y1; Y2; Y3; Y4; Y5

    Any ID that has nothing for Y1-Y5 should leave that part of the record empty.

    Any idea?

    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Well, a query that joins both of those tables together could produce that result. It would look like:

    SELECT Table1.ID, Table1.X1, Table2.Y1
    FROM Table1 LEFT JOIN Table2 ON Table1.ID = Table2.ID

    The key is the LEFT join, rather than the default INNER join. I left out all the other fields because I'm lazy. If you want to use that query to create or populate a new table, you should be able to.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    hara is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    4
    Tried that, but it returns a table that consist only of all records that are in Table2 (2,000). I am still missing the other 20,000 from Table1 in the new table.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Yes, that is the join issue I mentioned. If you're in query design view, right click on the line between the tables to edit the join. Choose the appropriate "Include all records...".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    hara is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    4
    Ah, I understand!

    Thanks a lot, that helped!

    By the way, any suggestions on how to learn Access?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    No problem, and welcome to the site by the way! I learned via sites like this and the "throw him in the middle of the pond to teach him how to swim" method. I have some helpful info and FAQ's at my website below, plus these are good references:

    The Access Web - Welcome
    Allen Browne's tips for Access users
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    hara is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    4
    Awesome! Thanks! Any suggestions on SQL?

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

Similar Threads

  1. Help needed with table design/layout for newbie
    By jase118 in forum Database Design
    Replies: 8
    Last Post: 06-05-2010, 02:59 AM
  2. Need appending help?
    By asilva in forum Access
    Replies: 6
    Last Post: 02-17-2010, 03:53 PM
  3. Appending to a Combo Box
    By cotri in forum Forms
    Replies: 5
    Last Post: 01-28-2010, 02:58 PM
  4. Appending a table with external script
    By farva in forum Import/Export Data
    Replies: 0
    Last Post: 11-09-2009, 12:12 PM
  5. Newbie Table Setup
    By debl5 in forum Access
    Replies: 3
    Last Post: 05-15-2009, 07: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