Returning to a Record on a form

A

Allen Browne

Use FindFirst on the RecordsetClone of the form to find the record again.

Assuming the primary key field is named "ID", and you want to find 44, you
would code like this:

With Me.RecordsetClone
.FindFirst "ID = 44"
If Not rs.NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
 
A

Aussie Jeff

Hi folks

I have a situation where i am trying to return to a particular record on a
form where i had been navigating thru a table.

I have buttons on the form eg ADD, EDIT, SAVE, CANCEL, EXIT and the
navigation controls enabled.

I reach a record say record 44 and then decide to ADD a new record and press
my ADD button which puts me into a new record and enables/disables my
buttons appropriately.

I then decide to CANCEL and not add the new record (me.undo etc) but I want
to return to where I was previously.

Normally I would be returned to the first record in the underlying
table/query.

Obviously, I could store my internal ID of the record I was on and then set
a filter to get back to it...but yes..that would mean I would no longer be
navigating thru the underlying records.

Is there a way to store the temporary recordno I was on and then use the
DoCmd.GoToRecord , , acGoTo, 44
or is there simply a better way?

Regards
Jeff
 
A

Aussie Jeff

Allen

You beauty!! I had a sneaking feeling you would be online and perusing the
forumns..... ;)

thank you Guru!!
cheers
jeff
 

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

Similar Threads

Clone Code Complication 2
FindFirst method not found 2
Openargs Not Working 2
searh for record. 2
Search Box 5
Problem with RecordsetClone when form has filter property set 1
lost focus...? 3
With error 7

Top