Requery then go back to same record.

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hi All,

I have a horrible feeling that I am asking too much here - at least with my
current skills!!!!

By design when I carry out a certain action on a form the underlying data is
required by the record goes back to the first record in the dataset. What do
I need to do so that the record goes back to the record that I was in?

Regards.
Bill.
 
When you requery, then that is what happens.

If you are causing the requery through code, you need to store the primary
key of the current record in a variable, do the requery, and then find the
original record and move to it in code. Something like the following AIR
CODE (untested) snippet.

Dim vPK as Long 'Assumption that your primary key is a number field

vPK = Me.txtBoxWithPrimaryKeyValue
Me.Requery

With Me.RecordsetClone
.FindFirst "PrimaryKeyField = " & vPK
If .NoMatch = False then
Me.Bookmark = .Bookmark
End IF
End With
 
Back
Top