Hi all!
I have this two dimmentional array which I sort and then I have to edit recordset.
I have this code, it works, but I have a feeling that it can be done in some more efficient way. Could you please help me with that?
Index = 1
rst.MoveFirst
Do While Index < 31
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 1
Index = Index + 1
Loop
Do While Index < 61
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 2
Index = Index + 1
Loop
Do While Index < 91
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 3
Index = Index + 1
Loop
Do While Index < 121
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 4
Index = Index + 1
Loop
Do While Index < 151
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 5
Index = Index + 1
Loop
Do While Index < 181
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 6
Index = Index + 1
Loop
Do While Index < 211
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 7
Index = Index + 1
Loop
Do While Index < 141
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 8
Index = Index + 1
Loop
I have this two dimmentional array which I sort and then I have to edit recordset.
I have this code, it works, but I have a feeling that it can be done in some more efficient way. Could you please help me with that?
Index = 1
rst.MoveFirst
Do While Index < 31
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 1
Index = Index + 1
Loop
Do While Index < 61
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 2
Index = Index + 1
Loop
Do While Index < 91
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 3
Index = Index + 1
Loop
Do While Index < 121
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 4
Index = Index + 1
Loop
Do While Index < 151
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 5
Index = Index + 1
Loop
Do While Index < 181
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 6
Index = Index + 1
Loop
Do While Index < 211
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 7
Index = Index + 1
Loop
Do While Index < 141
rst.Find "[SNumber]='" & mArray(Index, 2) & "'", , adSearchForward
rst.Fields(5) = 8
Index = Index + 1
Loop