We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,985 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

recordset position after delete & requery?

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!

3
Contributors
3
Replies
3 Days
Discussion Span
11 Months Ago
Last Updated
4
Views
Question
Answered
blocker
Posting Whiz
308 posts since Jan 2009
Reputation Points: 7
Solved Threads: 1
Skill Endorsements: 0
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...

AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

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

QVeen72
Veteran Poster
1,017 posts since Nov 2006
Reputation Points: 118
Solved Threads: 164
Skill Endorsements: 5

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

Thank you!

blocker
Posting Whiz
308 posts since Jan 2009
Reputation Points: 7
Solved Threads: 1
Skill Endorsements: 0
Question Answered as of 11 Months Ago by QVeen72 and AndreRet

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0644 seconds using 2.64MB