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
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