Refreshing a form and returning to last record on

J

John

What I am doing is that I have a detail form that I allow a user to edit more
information. When they close the detail form, I refresh the main form, but
it returns them to the top of the form. Is there a way to back to record
that the user was last on. I tried the goto record method and it did not
seem to do anything. I use the refresh method on the close of the detail
form.

Thanks in advance
 
M

Marshall Barton

John said:
What I am doing is that I have a detail form that I allow a user to edit more
information. When they close the detail form, I refresh the main form, but
it returns them to the top of the form. Is there a way to back to record
that the user was last on. I tried the goto record method and it did not
seem to do anything. I use the refresh method on the close of the detail
form.


Presumably the detail form is opened in dialog mode.

If so, save the current record's PK field, run the other
form, do the requery and then find the record with the saved
PK:

Dim lngPK As Long
lngPK = Me.txtPK
DoCmd.OpenForm "details", . . . , _
WindowMode:=acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "PK = " & lngPK
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End If
 

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