Good day g'Men!

I just needs some advise or code about positioning the recorset after requery!
I have 20 records in a table, I am on record no 10 and deleted it and pull movenext. The record to be view is record no 11. but a get the last record which is record no 20..

Here is the code so far:

dim rsbookmark as long
dim rsdelete as new Adodb.Recordset
dim objcommand as new objcommand.Command
objcommand.ActiveConnection-strconnection 'my cnn string
objcommand.CommandText="delete from tbl_pos_summary where record_no=10"
objcommand.CommandTimeout=600
set rsdelete=objcommand.Execute
rsdelete.requery
rsdelete.movenext

'data no 11 must be displayed but it displays the last record. I know Ado bookmark property would make this correct but I cant get it working.

Need your help guys.

Thank you!

Dim x as Integer

x = "10"

dim rsbookmark as long
dim rsdelete as new Adodb.Recordset
dim objcommand as new objcommand.Command
objcommand.ActiveConnection-strconnection 'my cnn string
objcommand.CommandText="delete from tbl_pos_summary where record_no='" & x & "'"
objcommand.CommandTimeout=600
set rsdelete=objcommand.Execute

x = x + 1
rsdelete.Bookmark = x

This should do the trick...

Hi,

Something like this :

dim i as long
i = rs.AbsolutePosition
rs.Delete
rs.ReQuery
If Not rs.EOF Then
    rs.MoveFirst
    rs.Move i
End If

Regards
Veena

thank you AndreRet, QVeen72. both works for me..The trick is that bookmark or absoluteposition must be initiated before the requery.

Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.