473,382 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to go back after Me.Requery ?

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
3 6528
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: scottallenmccullough | last post by:
I'm sure there is an easy solution for this problem. On "FORM A" is a combobox with a separate table as its record source. If the data required in the combobox is not one of the available choices...
20
by: MS | last post by:
Access 97 I want to requery the data being displayed on a form, then I want to return to the record I was in. Why doesn't this code work? Private Sub CmdRefsh_Click()
2
by: F. Michael Miller | last post by:
I need to requery a subform from a third form and can't seem to get it to work. frmForm1 has frmAddress as a subform. The button cmdReviseAddress opens the form frmUpdateAddress where all of my...
14
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button....
1
by: Parasyke | last post by:
I have a subform within a tabpage that will requery/refresh (?) if I press F9 and it will update the data in the subform, but I have tried various combinations of Me!SubformName.requery...
4
by: midlothian | last post by:
Hello, I have conditional formatting set up on a subform based on a calculated value in the underlying query. For instance, if Sales are >$1000, the query displays "Yes," otherwise it displays...
11
blyxx86
by: blyxx86 | last post by:
I can't seem to get this figured out. I am trying to requery another form after adding new information to a table that a cboList is created from. So, I have a combo box that has Sales personnel,...
2
by: Lyn | last post by:
Hi, I am using a form (FormA) to list the records in a recordset. In the FormA footer, I have an "Add" command button that opens a new form (FormB) modally which is used to input and save a new...
2
by: mslagle1 | last post by:
Hi all, I am trying to requery a subform "frmOpenWorkOrders" when a value list "status" on my main form "frmWorkOrderMain" is changed. If I change "status" then click on "frmOpenWorkOrders" and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.