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

R

Rick's News

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

Thanks In Advance...

Rick
 
D

Dirk Goldgar

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top