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

Is there a quicker way 1

Status
Not open for further replies.

fileman1

Technical User
Feb 7, 2013
152
GB
Is there a faster method to find a record than this?

Code:
 Do While Not rs3.EOF
    If rs3!TargetID = PK2 And rs3!ID1 = PK1 Then
        Do something in here 
        Exit Do
        End If 
     rs3.MoveNext
        Loop

Starting to take a while to find
 
If DAO and PKs are numeric:
Code:
rs3.FindFirst "TargetID=" & PK2 & " AND ID1=" & PK1
If Not rs3.NoMatch Then
  Do stuff here
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am looping a recordset in vba to find a record in the recordset that meets with 2 conditions being met

rs3!TargetID = PK2 And rs3!ID1 = PK1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top