470,588 Members | 2,126 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,588 developers. It's quick & easy.

Resetting the Recordset while within the Form - how?

I might not have phrased the question correctly in the Subject of this
post. Please read the entire explanation.

I have a form with a command button (Add New Person). This button opens
up another form (frmPeople) with a NewRecord (blank fields). The
frmPeople form has a command button to save the record. I call this
scenario ADD Mode. When the record is saved we stay in ADD Mode and get
another NewRecord.

This form (frmPeople) may, also, be entered by selecting a person's name
from a combobox. This opens up frmPeople with the entire recordset
available and positioned at the selected person. I call this BROWSE
Mode. All fields are protected until the user hits the EDIT command
button.

I want to change this a bit. After the NewRecord is saved, instead of
staying in ADD Mode, I want to go into BROWSE Mode and have all records
available. I want to be positioned at the newly saved record.

I thought that I could use the Requery method on the form (me.Requery)
to pull in all records based on the RecordSource already defined in the
form's attributes. That doesn't seem to work, because when I code the
following after the Requery ...

'Position current record to the record just saved
Set db = CurrentDb
Set rs = Me.RecordsetClone
rs.FindFirst "[peopleID] = " & lngPID
Me.Bookmark = rs.Bookmark

it fails on the "me.bookmark = rs.bookmark" instruction with "No current
record" error.

Does anyone have any suggestions?

- SueB

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
3 2987
Susan Bricker <sl*****@verizon.net> wrote in
news:9l**************@news.uswest.net:
I might not have phrased the question correctly in the Subject
of this post. Please read the entire explanation.

I thought that I could use the Requery method on the form
(me.Requery) to pull in all records based on the RecordSource
already defined in the form's attributes. That doesn't seem
to work,
Does anyone have any suggestions?


If your frmPeople is still in data entry mode, e.g. the data entry
property is true, requerying the form won't help. You need to set
it to false, then requery. Start by checking that.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2
"Bob Quintal" <rq******@sympatico.ca> wrote
If your frmPeople is still in data entry mode, e.g. the data entry
property is true, requerying the form won't help. You need to set
it to false, then requery. Start by checking that.


And, the Bookmark is invalidated when you requery, so you need to do a Find
on the unique identifier of the just-added Record, and use the _new_
Bookmark.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #3
Bob,

It's a miracle. Ok ... maybe not a miracle but I'm thrilled to tell you
that IT WORKED. Thanks so much.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by timchalk | last post: by
2 posts views Thread by ano1optimist | last post: by
8 posts views Thread by LabGeek | last post: by
4 posts views Thread by Ian Davies | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.