Moving to a record on a subform

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

Guest

I have a relatively simple procedure to add a record to a subform. Once the
user choose the correct information and clicks a button, the record is added
to the record source of the subform, the subform is requeried and then I want
to move the focus to the record that was just entered.

I've tried all kinds of things to get this to work. The best I have gotten
is to actually move the cursor to the new record (which should always be at
the end of the record source since the date that is added is the current
date). However, even though the cursor moves to the record in question, the
subform doesn't actually display. The scroll doesn't move and since there are
over 2K records displaying in the sub, this is an issue.

The new record is added by creating a record set that is a clone of the sub
and I use .AddNew. Then I requery the subform. The new record appears, but
that's it. Also, bookmarking doesn't seem to work. I've tried to grab a
bookmark at the time the record is added and then set the bookmark after
requery.

I have not posted the code because it is fairly simple and I think I am
missing something easy. Perhaps by using a clone?

Thanks in advance,
Clint Herman
 
Clint, if you used AddNew on the RecordsetClone of the subform, you don't
need to requery: it is already there in the subform. All you need to is to
set the bookmark of the form to the LastModified bookmark that Access keeps
on the recordset, e.g.:

rs.AddNew
rs!Field1 = 2
'etc
rs.Update
Me.Bookmark = rs.Lastmodified
 

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

Back
Top