How save and restore position in continuous form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a continuous form that I use as a selection list. When I select a row
and press a button, another form opens; when I exit from the second form I
need to requery the first form to update the row. However, I lose the
selection pointer - it always goes to the top. I'd like it to reappear on the
row I originally selected. What is the best way to do this? I'm already using
openargs to pass information from the first from to the second.

Thanks - David
 
Before you requery the form, save the value of the Unique ID field for the
record, requery, then do a FindFirst for the value you saved. This will
return the form back to the record it was on before the requery. To make
this look better, you may want to disable Echo while you do this and turn it
back on once you're done.
 
mscertified said:
I have a continuous form that I use as a selection list. When I select a row
and press a button, another form opens; when I exit from the second form I
need to requery the first form to update the row. However, I lose the
selection pointer - it always goes to the top. I'd like it to reappear on the
row I originally selected. What is the best way to do this? I'm already using
openargs to pass information from the first from to the second.


To reposition the form back to the record, save the record's
key field, do the requery and then find the record again.
For a Long Integer or Autonumber type primary key field, the
code could look like:

Dim lngKey As Long
lngKey = Me.Key
Me.Requery
Me.Recordset.FindFirst "Key=" & lngKey
 
Back
Top