Alternate data from two different columns into rows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chopin
    New Member
    • Mar 2007
    • 37

    Alternate data from two different columns into rows

    I was wondering if there was a way to alternate data taken from two different columns in a query, then placing that data into a another query or table. For example, let's say I have the following query, with the respective columns:

    column1.......c olumn2
    A.............. ......1
    B.............. ......2
    C.............. ......3
    D.............. ......4

    Then I would like to input the above information into another query/table like so:

    A
    1
    B
    2
    C
    3
    D
    4

    Is there any way to successfully do this?
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    You could create two recordsets: one against the original table/query and one against your target table/query. What you would do then is read through Recordset1 and update Recordset2 as you go. Something like:
    Code:
    rs2.fields(0) = rs1.fields(0).value
    rs2.MooveNext()
    rs2.fields(0) = rs1.fields(1).value
    rs2.MooveNext()
    Loop

    Comment

    Working...