Using .Find with ADO
hi..
I want to find a record in a recordset and after that, I want to retrieve data from the previous record of the found record. But when I reached to the .find sTmp, I got this error
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. 3001
here is the code I used..
cnn.CursorLocation = 3
cnn.Open "Provider=SQLOLEDB.1;**************"
sTmp = Trim(frmCustomer.txtCustomerCode.Text)
sql = "SELECT * FROM Customer Where CustomerCode='" & sTmp & "'"
rstCust.Open sql, cnn, adOpenStatic, adLockOptimistic
If rstCust.RecordCount <> 0 Then
rstCust1.Open "Customer", cnn, adOpenStatic, adLockOptimistic
rstCust1.Find sTmp
rstCust1.MovePrevious
End if
The way of using .Find is ok with DAO. But I can't use it here. Is there any wrong with my code or whatelse I need to do.. Is there other way to point out the required record and go to the previous and next record of it.
Tks alot for any help and reply..
|