How to move to first record within a subform

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hello everyone,
I'm sure the answer to this must be simple but...
I have a subform with lists of records displayed as a
continuous form. Next to each of these records I've got
a Delete Record button. Supposing there are six records
within the subform (that relate to the main form) and the
user decides to delete the fourth record. They then
change their mind and click on the Cancel button on the
dialogue box that asks them to confirm the delete. The
subform then moves the focus so that the fourth record
now appears at the top of the list. I realise that all
the records are still in place but as this has led to
some confusion I'd rather the focus was set back to the
FIRST record (of the six).
I've fiddled about with recordsets and then requerying
but I'm obviously doing something wrong as
the 'undeleted' record is removed! Can you help me with
this?!!

Many thanks in advance.

Regards,

Lee
 
After executing the Delete, in the Module code of the Form embedded in the
Subform Control --

Me.cboWhatever.Requery 'this may not be needed
Me.RecordsetClone.MoveFirst 'locat first record
Me.Bookmark = Me.RecordsetClone.Bookmark
' synch recordsetclone and form to 1st

That's aircode, untested, but what it is intended to do is to use the
Bookmark of the Form's RecordsetClone to locate the first record and then
position to that first record.
 
Back
Top