By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

How to go back after Me.Requery ?

P: n/a
kai
Hi,
I use Access 2003, I put "Me.Requery" in code under a button click to
reload the form. I always in the first record after reload, which is
normal. But I want to go back the initial record before "Me.Requery" . Is
this possible?

Thanks

Kai
Jul 25 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Tue, 25 Jul 2006 17:34:31 -0400, kai wrote:
Hi,
I use Access 2003, I put "Me.Requery" in code under a button click to
reload the form. I always in the first record after reload, which is
normal. But I want to go back the initial record before "Me.Requery" . Is
this possible?

Thanks

Kai
Presumably your record has a unique prime key [ID] field.

Dim lngRecNo As Long
RecNo = Me![ID]
Me.Requery
Me![ID].SetFocus
DoCmd.FindRecord lngRecNo, acEntire, , acSearchAll

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jul 25 '06 #2

P: n/a
kai
Fred,
Thanks for your help.
It still goes back to the first record, I think after reload,

RecNO lose the value form
RecNo = Me![ID]

I am trying to save the Me![ID] into the table, after reload, read it from
the table.

Thanks

Kai

"fredg" <fg******@example.invalidwrote in message
news:1b******************************@40tude.net.. .
On Tue, 25 Jul 2006 17:34:31 -0400, kai wrote:
>Hi,
I use Access 2003, I put "Me.Requery" in code under a button click to
reload the form. I always in the first record after reload, which is
normal. But I want to go back the initial record before "Me.Requery" .
Is
this possible?

Thanks

Kai

Presumably your record has a unique prime key [ID] field.

Dim lngRecNo As Long
RecNo = Me![ID]
Me.Requery
Me![ID].SetFocus
DoCmd.FindRecord lngRecNo, acEntire, , acSearchAll

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Jul 26 '06 #3

P: n/a
kai wrote:
Fred,
Thanks for your help.
It still goes back to the first record, I think after reload,

RecNO lose the value form
RecNo = Me![ID]

I am trying to save the Me![ID] into the table, after reload, read it from
the table.

Thanks

Kai
Dim lngID As Long
Dim rst As DAO.Recordset
lngID = Me.ID 'assumes the key is called ID and is a longint
Me.Requery
set rst = Me.Recordsetclone
rst.findfirst "ID = " & lngID
Me.Bookmark = rst.Bookmark
set rst = Nothing

Jul 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.