moving record pointer in form

  • Thread starter Thread starter TracyG
  • Start date Start date
T

TracyG

I am doing a record add through form code. After the new record is added I
want to move the current record pointer to this newly added record. How do
I accomplish this?
 
The simplest thing would be to AddNew to the RecordsetClone of the form.
Then set the form's Bookmark to LastModifed.

This kind of thing:
Dim rs As DAO.Recordset
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.AddNew
!SomeField = 99
!AnotherField = "xxx"
'etc
rs.Update
Me.Bookmark = rs.LastModified


If you cannot use that approach, you will need to Requery the form and then
FindFirst the new key value.
 

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