Requery

  • Thread starter Thread starter gr
  • Start date Start date
G

gr

Hello!
Is there any way to requery a form and then return to the
last visited record(last current record)?

Current record where code starts ---> Requery form, now
current record is first record ---> Return to original
current record where code started.

I was using the bookmark property with no luck..

strBookmark = Me.Bookmark
..... ....
..... ....
..... ....
Me.Requery
Me.Bookmark = strBookmark

Error 3159: Not a valid bookmark... =/

thx.
 
gr said:
Hello!
Is there any way to requery a form and then return to the
last visited record(last current record)?

Current record where code starts ---> Requery form, now
current record is first record ---> Return to original
current record where code started.

I was using the bookmark property with no luck..

strBookmark = Me.Bookmark
.... ....
.... ....
.... ....
Me.Requery
Me.Bookmark = strBookmark

Error 3159: Not a valid bookmark... =/

Bookmarks are reset when you requery the form. You need to store the
Primary Key value of the current record, issue the requery, and then use
the stored PK value to return to the record you were on.

curRecord = Me.PKField
Me.Requery
Me.RecordsetClone.FindFirst "[PKField] = " & curRecord
Me.Bookmark = Me.RecordsetClone.Bookmark

Note that this is very inefficient on large RecordSets where you should be
restricting the rows to the record you are interested in anyway.
 
Back
Top