There has got to be a faster way of doing this.
At first I was using code to open and close the recordset, this is way too slow.
I then thought it would be faster to leave the recordset open and just filter within it. This took 10x as long.
What is a better way to search this?
At first I was using code to open and close the recordset, this is way too slow.
Code:
For i = lstvwBreakdown.ListItems.Count To 1 Step -1
strSQL = "SELECT SONO,ITEM FROM tblSchedBkt WHERE SONO = '" & lstvwBreakdown.ListItems(i).Text & "' AND ITEM = " & lstvwBreakdown.ListItems(i).SubItems(1)
objRS.Open strSQL, objCon, adOpenKeyset, adLockReadOnly
If Not objRS.EOF Then
frmSplash.lblProg.Caption = "Assigning - " & lstvwBreakdown.ListItems(i).Text
DoEvents
lstvwBreakdown.ListItems.Remove i
End If
objRS.Close
Next
I then thought it would be faster to leave the recordset open and just filter within it. This took 10x as long.
What is a better way to search this?
Code:
strSQL = "SELECT SONO,ITEM FROM tblSchedBkt" ' WHERE
objRS.Open strSQL, objCon, adOpenKeyset, adLockReadOnly
For i = lstvwBreakdown.ListItems.Count To 1 Step -1
objRS.MoveFirst
strFindstring = "SONO = '" & lstvwBreakdown.ListItems(i).Text & "' AND ITEM = '" & lstvwBreakdown.ListItems(i).SubItems(1) & "'"
objRS.Filter = strFindstring
If Not objRS.EOF Then
frmSplash.lblProg.Caption = "Assigning - " & lstvwBreakdown.ListItems(i).Text
DoEvents
lstvwBreakdown.ListItems.Remove i
End If
objRS.Filter = ""
Next
objRS.Close