Why Bookmark and RecordsetClone to return to record?

  • Thread starter Thread starter Claire
  • Start date Start date
C

Claire

Hi all,
I'm working on a form that will need to be requeried after a number of
different on click events. At this point I want to return to the record that
was current before. According to my various resources, including here, I
should note the primary key, requery, clone the recordset, find the primary
key in the clone, set that record as the bookmark and then set the cloned
bookmark as the forms bookmark. Why is this better than just noting the
primary key, requerying and finding the primary key on the form's recordset?
I feel like I'm missing something here...

Thanks for you thoughts,
Claire
 
Claire said:
I'm working on a form that will need to be requeried after a number of
different on click events. At this point I want to return to the record that
was current before. According to my various resources, including here, I
should note the primary key, requery, clone the recordset, find the primary
key in the clone, set that record as the bookmark and then set the cloned
bookmark as the forms bookmark. Why is this better than just noting the
primary key, requerying and finding the primary key on the form's recordset?
I feel like I'm missing something here...

You're not missing anything. RecordsetClone is the thing to
use when you do not want to affect the form's current
record. In your case you are trying to affect the form's
recordset so it is appropriate to do that:

Me.Recordset.FindFirst "pkfield=" & Me.pkfield

There are a lot of hold over code examples from A97 and
earlier that use RecordsetClone because the Recordset
property did not exist back then.
 
I never knew you could do this (never tried)... I've just always seen the
Clone option and that's what I've always went with. Thanks for bringing that
up... always interesting to re-learn what you thought you knew :-)

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Back
Top