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

Need help understanding the FIND method of a recordset.

Status
Not open for further replies.

Ekliptic

Programmer
Dec 12, 2000
23
0
0
CA
I'm using the find method of a recordset but am getting the error "Rowset does not support scrolling backwards". I don't understand why I'm getting this error message when my code looks like this: (Note: the default direction to the find method is adSearchForward)

Customers.MoveFirst
If Not Customers.BOF And Not Customers.EOF Then
'******It errors on the next line***********
Customers.Find "CustomerID = 'ALFKI'"

gs_CustomerID = IIf(IsNull(Customers("CustomerID")), 0, Customers!CustomerID)

gs_CompanyName = IIf(IsNull(Customers("CompanyName")), 0, Customers!CompanyName)

gs_ContactName = IIf(IsNull(Customers("ContactName")), 0, Customers!ContactName)
End if

Any help would be appreciated...

tschock

 
Try Customers.FindFirst and Customers.FindNext Rob Marriott
robert_a_marriott@yahoo.com

Hire me! Full-time, contract, whatever...shhh don't let my current employer know I said that.
 
Unfortunately I don't think ADO has the findfirst and findnext methods.
 
Try this
adSearchForward 'direction to search
adBookmarkFirst = 1 'record to start at

Customers.Find "CustomerID = 'ALFKI'", , adSearchForward, adBookmarkFirst

You could probably issue a .movefirst(to take you to the begging of the recordset) before using your code also.

David Paulson


 
That seemed to work! I guess you have to specify adSearchForward and the adBookmarkFirst even though the default is adSearchForward.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top