Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I return to the current record after a requery?

Status
Not open for further replies.

BeallDon

Technical User
Aug 20, 2007
46
CA
I have a form with a "save" command button. After I enter data in the form, I click the "save". The current record is saved, a few calculations run, and the form is requeried. It runs fine, but after the requery, it goes to the first record. What code would I need in the "save" for it to remember which record I am on and return to that record after the requery?

Thanks in advance.
 
See the use of "BookMark" property i vba help file.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
How are ya Jedody69 . . .

A starting point (you substitute proper names in [purple]purple[/purple]):
Code:
[blue]   Dim hldID, Cri As String
   
   hldID = Me![purple][b][i]YourIDName[/i][/b][/purple]
   [green]'
   'Your code here
   '
   'Me.Requery
   '[/green]
   Cri = "[[purple][b][i]YourIDName[/i][/b][/purple]] = [red][b]'[/b][/red]" & hldID & "[red][b]'[/b][/red]"
   Me.Recordset.FindFirst Cri[/blue]
If your ID is numeric, remove the two single qoutes [red]'[/red] in red . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Thanks so much TheAceMan1. Once again, you have clearly given me the exact advise i was looking for. It works PERFECTLY!! Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top