×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Converting rows into columns in Access .ADP

Converting rows into columns in Access .ADP

Converting rows into columns in Access .ADP

(OP)
I am working in .ADP and converting .mdb modules to .adp;i am facing a problem in making a loop through each record.
I have a table 1 like this:

cellname;neighbor
a          b
a          c
a          d
a          e

i want to put these in another table 2 like this:
cellname;neigh1;neigh2;neigh3;neigh4
a          b      c      d      e
Please guide how to do this in .ADP module.
There are more than one cell name and more than 4 neighbors,This is just for example.Infact neighbors equal64.Also,there is autonumber field in the table.Kindly guide in the form of code.
this is what i used in MS Access.mdb but i need similar thing in .ADP

sample code:
SQL = "SELECT RFPlanNei_OMC2_Modified.SourceLAC_CI, RFPlanNei_OMC2_Modified.DestLAC_CI FROM RFPlanNei_OMC2_Modified ORDER BY RFPlanNei_OMC2_Modified.SourceLAC_CI"
Set sql1 = CurrentDb.OpenRecordset(SQL)

While Not sql1.EOF
source = sql1.Fields.Item(0)

For i = 1 To 36
NC(i) = ""
Next i

a = 1

    While source = sql1.Fields.Item(0) And a < 37
    NC(a) = sql1.Fields.Item(1).value
    a = a + 1
    sql1.MoveNext
    If sql1.EOF = True Then
        sql2 = "Insert Into RFPlanNei_Modified_Final(CELLID, NC1, NC2, NC3, NC4, NC5, NC6, NC7, ) values ( '"
        sql2 = sql2 & source & "','" & NC(1) & "','" & NC(2) & "','" & NC(3) & "','" & NC(4) & "','" & NC(5) & "','" & NC(6) & "','" & NC(7)
    DoCmd.RunSQL sql2
    GoTo BreakLoop
    End If
    Wend
  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close