Problem when deleting records in 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
 
Lee said:
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).

Lee,

you did not posted your code, so it's a bit of a guess as to where to
put the code I'm writing. You would need to set the bookmark in the
subform, something like this:

Dim rst As DAO.Recordset

Set rst = Me.RecordsetClone
rst.MoveFirst
Me.Bookmark = rst.Bookmark

The code would go in the Click event procedure of the Delete button.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top