Refreshing the current recordset

  • Thread starter Thread starter Jody
  • Start date Start date
J

Jody

Good day,

I successfully requery a main form by executing the
following code within a subform:

Forms!frmSubscriberMain.Requery

The problem I have is that when I requery the main form,
the displayed recordset changes in the form (reverts back
to the first recordset in the sort order).

How do I both refresh the data AND keep the current
recordset?

Thanks,
Jody
 
I believe you can do this by "capturing" the primary key of the record that
you're currently on, and then moving the recordset to that record after the
requery.

Dim varPrimaryKey As Variant
....
....
....
varPrimaryKey = Forms!frmSubscriberMain.PrimaryKeyControl.Value
Forms!frmSubscriberMain.Requery
Forms!frmSubscriberMain.Recordset FindFirst "[PrimaryKeyControl] = " &
varPrimaryKey
 
Back
Top