G
Guest
My objective seems simple enough but I am unclear what is happening behind
the scenes with bookmarks and recordset clones. I want to capture the current
record, requery the form, which I know moves me to record one, then move back
to the original record. There is no primary key, so I can't store a variable
and use FindFirst. Below is the code, which executes without an error but
leaves me at record one. Furthermore, the boolean switch on the datasheet
does not reflect the change, despite the fact that I can watch the progress
bar as it calculates. Closing and opening the form properly displays the
changes, but that is not elegant. The code is behind a command button on
another form and I want the requery to occur on the Selector form in
datasheet mode. Any help would be appreciated. Thanks.
Public Location As Variant
TargetForm = "frm Selector" ' Datasheet display
Me.Sample = True ' Flip a boolean switch
Dim rst As Object
Set rst = Forms(TargetForm).Recordset.Clone
Location = rst.Bookmark
Forms(TargetForm).Requery
Forms(TargetForm).SetFocus
Forms(TargetForm).Bookmark = Location
the scenes with bookmarks and recordset clones. I want to capture the current
record, requery the form, which I know moves me to record one, then move back
to the original record. There is no primary key, so I can't store a variable
and use FindFirst. Below is the code, which executes without an error but
leaves me at record one. Furthermore, the boolean switch on the datasheet
does not reflect the change, despite the fact that I can watch the progress
bar as it calculates. Closing and opening the form properly displays the
changes, but that is not elegant. The code is behind a command button on
another form and I want the requery to occur on the Selector form in
datasheet mode. Any help would be appreciated. Thanks.
Public Location As Variant
TargetForm = "frm Selector" ' Datasheet display
Me.Sample = True ' Flip a boolean switch
Dim rst As Object
Set rst = Forms(TargetForm).Recordset.Clone
Location = rst.Bookmark
Forms(TargetForm).Requery
Forms(TargetForm).SetFocus
Forms(TargetForm).Bookmark = Location