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

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.
 
A

Armen Stein

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top