Requery and Bookmarks for Recordsets (1 Viewer)

KernelK

Registered User.
Local time
Today, 16:42
Joined
Oct 3, 2006
Messages
173
Can anybody confirm one way or the other, of whether or not requerying a recordset will destroy (break or otherwise invalidate) bookmarks that you have set for said recordset? I would think that it wouldn't, as requerying the recordset simply refreshes the data held without changing any of the recordset specs (unlike closing and reopening), wouldnt the bookmark property for each record be maintained as well? Just wondering if anyone has any "official" word on the subject as I cannot find a reliable test for this, as even the help states

"The user may not be able to view the value of the bookmark. Also, users should not expect bookmarks to be directly comparable—two bookmarks that refer to the same record may have different values."

So there goes testing the bookmark value to see if it has been destroyed by the requery.

Any help on the subject would be appreciated.
 

KernelK

Registered User.
Local time
Today, 16:42
Joined
Oct 3, 2006
Messages
173
I did find an example that Microsoft created for another problem, that involves creating a bookmark before the requery and then referencing that bookmark to get back to the previous cursor position. But, that is as "official" as I have found, microsoft using the method, but not explicity stating that it works properly. Comments still welcome though.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:42
Joined
Feb 19, 2002
Messages
43,560
Requerying the recordset reruns the query. That means that due to additions/deletions, records may change position. That invalidates bookmarks. I don't know if they are invalidated after a refresh which only picks up changes to existing records. You'd need to test to find out.
 

KernelK

Registered User.
Local time
Today, 16:42
Joined
Oct 3, 2006
Messages
173
Thanks for the response. I went back and looked at that microsoft article again (http://support.microsoft.com/kb/221931), and found that were not actually using the bookmark property. They used a variable named bookmark to store the absolutesposition of the recordset, requeryed and then returned to the absoluteposition from the variable. So they were not in fact using the bookmark property as I had thought at first glance. So, if I absolutely need to do a requery on my recordset, I'm going to have to use the primary key (or some other unique field) to do a find on the recordset to return to that record? How lame.
 

Users who are viewing this thread

Top Bottom