Dim qryD As DAO.QueryDef
Dim rs As DAO.Recordset2
TimerTest = Now
Found = 0
Set qryD = CurrentDb.CreateQueryDef( _
vbNullString, _
"PARAMETERS SearchPart Text ( 255 );" & _
"SELECT tblParts.* " & _
"FROM tblParts " & _
"WHERE (((tblParts.[PART#])=[SearchPart]));")
With qryD
.Parameters(0) = PartID(0)
Set rs = .OpenRecordset()
For i = 1 To UBound(PartID)
If rs.RecordCount > 0 Then
rs.MoveFirst
If rs![Part#] = PartID(i - 1) Then
Found = Found + 1
End If
End If
.Parameters(0) = PartID(i)
rs.Requery qryD
Next
.Close
Set rs = Nothing
End With
Set qryD = Nothing
Debug.Print "Select Parm requry time: " & _
DateDiff("s", TimerTest, Now) & _
" Seconds, Found: " & _
Found
TimerTest = Now
Found = 0
With CurrentDb.OpenRecordset("tblParts", dbOpenTable)
.Index = "PrimaryKey"
For i = 0 To UBound(PartID)
.Seek "=", """" & PartID(i) & """"
If Not .NoMatch Then
If ![Part#] = PartID(i) Then
Found = Found + 1
End If
End If
Next
.Close
End With
Debug.Print "Seek multi time: " & _
DateDiff("s", TimerTest, Now) & _
" Seconds, Found: " & _
Found - 1