How To: Come back to the current record after requery???

  • Thread starter Thread starter Rick's News
  • Start date Start date
R

Rick's News

How do I code to come back to the current record after requery???

Thanks In Advance...

Rick
 
Rick's News said:
How do I code to come back to the current record after requery???

The only thing you can count on to be the same after a requery is the
record's primary key. So save that key before you requery and then use
the form's recordset to find it again afterward. For a numeric key
field (named "ID" in this example) and Access 2000 or later, you can
write something like this:

Dim varID As Variant ' could use more specific data type

varID = Me!ID.Value
Me.Requery
Me.Recordset.FindFirst "ID=" & varID

For Access 97 you have to use the RecordsetClone and Bookmark
properties, but the principle is the same.
 
Back
Top