setting the Focus to the current record in a multiple record subfo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with two subforms (A & B). When I change value in subform A, I
am perform a requery of subform B and then using set focus to return the
cursor back to subform A. This is working fine, except that the set focus
always returns to the first record in subform A (It is the continuous record
view). I want it to return the focus to the record I just changed values in.
 
It sounds like you're also requerying Subform A, or possibly the main form.
If you can eliminate that requery, you might not have a problem.

However, if that doesn't work, the Bookmark property might help.

To position to a certain record, store Me.Bookmark in a variable before you
leave the subform A. When you set focus back to subform A, set Me.Bookmark
back to the variable.

Note that the Bookmark value won't be valid after a requery of the form's
recordset, so you may have to instead remember the primary key of the
desired record in the form, then use a RecordsetClone to Find the desired
record again and set Me.Bookmark to the Recordset.Bookmark.
 
Back
Top