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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array & recordset

Status
Not open for further replies.

Alira

Programmer
Mar 21, 2001
77
CA
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 &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 1
Index = Index + 1
Loop
Do While Index < 61
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 2
Index = Index + 1
Loop
Do While Index < 91
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 3
Index = Index + 1
Loop
Do While Index < 121
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 4
Index = Index + 1
Loop
Do While Index < 151
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 5
Index = Index + 1
Loop
Do While Index < 181
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 6
Index = Index + 1
Loop
Do While Index < 211
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 7
Index = Index + 1
Loop
Do While Index < 141
rst.Find &quot;[SNumber]='&quot; & mArray(Index, 2) & &quot;'&quot;, , adSearchForward
rst.Fields(5) = 8
Index = Index + 1
Loop
 
'IT WILL WORK ONLY WITH MICROSOFT JET ENGINE
For i=1 To 8
For j=1 To 30
Index=(i-1)*30+j
rst.Find &quot;[SNumber]= '&quot; _
& mArray(Index, 2) & &quot;'&quot;, , adSearchForward
if NOT rst.Nomatch then _
rst.Fields(5) = i
Next
Next
 
Thanks a lot!

It works perfectly, but I removed .nomatch. This array is always 240/240 elements, it's not getting to this stage if it is not.

Cheers:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top