Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting rows into columns in .ADP

Status
Not open for further replies.

sql66666

Programmer
Feb 28, 2012
4
SA
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.
 
Are there only 4 choices per cellname? Are they the same 4 choices for each cellname? Is their a autonumber field in that table?

Simi
 
Sounds to me that this should be in the access Forum

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Bernard Baruch

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
no 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


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
 
As i said before this is a Microsft SQL server forum - not Access. ADP is a access project if i am not mistaken.

This forum is the one you should post in:


----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Bernard Baruch

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top