[AccessD] Speed up Search

Lonnie Johnson prodevmg at yahoo.com
Fri Dec 5 13:40:11 CST 2003


I have a form that uses a linked SQL Server table. I have a name search that uses the recordsetclone in a DAO recordset to bookmark the postion and GoTo that record. I believe my problem is with the FindFirst.

I have been advised to requery the form's recordset with a filter of the criteria in question. The only problem is that the user needs to scroll to the next record sometimes. If I filter, then the next record is no longer available. 

Any suggestions to having my cake and eating it to would be greatly appreciated.


My code:


    If IsNull(cboFNAME) Or IsNull(cboLNAME) Then
    MsgBox "YOU ARE MISSING THE FIRST OR LAST NAME."
    Exit Sub
    End If
    
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    
    Set db = CurrentDb
    
    Set rs = Me.RecordsetClone
    
    rs.MoveLast
    rs.MoveFirst
    
    rs.FindFirst "LNAME = " & Chr(34) & cboLNAME & Chr(34) & " AND FNAME = " & Chr(34) & cboFNAME & Chr(34)
    If rs.NoMatch = False Then
    Me.Bookmark = rs.Bookmark
    End If
    
    cboLNAME = ""
    cboFNAME = ""
   
   cboLNAME.SetFocus





Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us




 




---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now


More information about the AccessD mailing list