Click to See Complete Forum and Search --> : How to use Find in ADO?


July 31st, 2000, 10:41 PM
I can't seem to find this anywhere. Can someone please give me an explanation of all the parameters required in the Find function of an ADO recordset?

Find (criteria, SkipRows, searchDirection, start)
I know criteria is a search string, that's all. I do not know how to utilise the others. My problem is that if I only supply the criteria, it will only know how to search forward from the current position. I need it to restart again from the beginning, and I would prefer not to have to use .movefirst as it might conflict with some other part of my coding.

My code so far:

Private Sub cboAgentCode_Change()
On Error GoTo NotFoundErr
Dim x As String
x = "intAgentCode = " & cboAgentCode.Text
datAgent.Recordset.Find (x)

Exit Sub
NotFoundErr:
MsgBox Err.Description
End Sub

Brooks
August 4th, 2000, 08:46 AM
With Seek and Find, your cursor will be repositioned to the corresponding "found" record. Therefore, you will need to save your current location and do a MoveFirst, and later do a MoveFirst followed by a Move with the increment equal to your original index minus one.

(703) 435-1696