Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Recordset Find Method Problem...

mohsinalimohsinali Member Posts: 85
[b][red]This message was edited by mohsinali at 2003-11-15 23:58:24[/red][/b][hr]
Well,
Its my first post to this board. I am here with a little problem. Let I have a recordset like this

[code]
Dim RS as New Recordset

RS.CusrsorLocation = adUseClient
RS.Open "SELECT * FROM MYTABLE ORDER BY CODE "
[/code]

Then I move upto some records like this

[code]

'Move 50 Records ahead
For i = 0 to 50
RS.MoveNext
Next i
[/code]

Now I search something like this

[code]
RS.Find "name='Mohsin'"

If RS.EOF Then
MsgBox "Not Found"
Else
MsgBox RS("name")
End If


[/code]

Now what this code will do that if the name is found, then the Record will be pointing, or in otherwords will land on to the record whose name field is 'Mohsin', and if not, then it will land at EOF.

But what if I need to point back the Recordset to the location where I was before invoking the Find Method?
I mean any Bookmark or anything like that...?
Regards,
mohsinali


Comments

  • WolfsbaneWolfsbane Member Posts: 12
    Did you try saving the CursorLocation value to a variable prior to loading the find function? That way you could refer back to the last location.
    : [b][red]This message was edited by mohsinali at 2003-11-15 23:58:24[/red][/b][hr]
    : Well,
    : Its my first post to this board. I am here with a little problem. Let I have a recordset like this
    :
    : [code]
    : Dim RS as New Recordset
    :
    : RS.CusrsorLocation = adUseClient
    : RS.Open "SELECT * FROM MYTABLE ORDER BY CODE "
    : [/code]
    :
    : Then I move upto some records like this
    :
    : [code]
    :
    : 'Move 50 Records ahead
    : For i = 0 to 50
    : RS.MoveNext
    : Next i
    : [/code]
    :
    : Now I search something like this
    :
    : [code]
    : RS.Find "name='Mohsin'"
    :
    : If RS.EOF Then
    : MsgBox "Not Found"
    : Else
    : MsgBox RS("name")
    : End If
    :
    :
    : [/code]
    :
    : Now what this code will do that if the name is found, then the Record will be pointing, or in otherwords will land on to the record whose name field is 'Mohsin', and if not, then it will land at EOF.
    :
    : But what if I need to point back the Recordset to the location where I was before invoking the Find Method?
    : I mean any Bookmark or anything like that...?
    : Regards,
    : mohsinali
    :
    :
    :

Sign In or Register to comment.