Results 1 to 2 of 2

Thread: Append Query

  1. #1
    Join Date
    Jun 2011
    Posts
    1

    Unanswered: Append Query

    Hi, hope someone can help.

    I've inherited a database, with an exisiting append query but I need to modify it.

    I have a table which has 2 columns of "authors" and I need to append the contents of both those columns into one column in the receiving table. Currently the append query is set up to append one of the columns of authors from the origin table to one column in the receiving table.

    Can anyone help? I've tried just adding annother column to the Append Query it but it doesn't work?
    Wendy

  2. #2
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183

    Append Query

    I don't see any possibility of doing this in one step, but if it is in two steps then we have two ways to do it. With VBA we need only a small routine.

    1. Create two append Queries with first column in first Query and the second column in the other.
    2. Create a Union Query and use it as input to the Append Query.


    1. Sample SQL for the first method:

    Append Query1
    Code:
    INSERT INTO Table2 (Field1, Field2, Field3, Column1)
    SELECT Table1.Field1, Table1.Field2, Table1.Field3, Column1
    FROM Table1;
    Append Query2
    Code:
    INSERT INTO Table2 (Field1, Field2, Field3, Column2)
    SELECT Table1.Field1, Table1.Field2, Table1.Field3, Column2
    FROM Table1;
    Sequence the queries in a Macro.

    2. Sample SQL for the Second Method:

    Query1 (Union Query)

    Code:
    SELECT Field1,Field2,Field3,COLUMN1 FROM Table1
    UNION ALL SELECT Field1,Field2,Field3,COLUMN2 FROM Table1;
    Append Query
    Code:
    INSERT INTO Table2 (Field1, Field2, Field3, COLUMN1)
    SELECT Query1.Field1, Query1.Field2, Query1.Field3, COLUMN1
    FROM Query1;
    Sequence the queries in a Macro.
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •