Form_BeforeDelConfirm: Checking Values In Record TB Deleted?

P

PeteCresswell

When the user clicks "Delete" on a subform, I want to do some checking
against values of the record tb deleted before allowing the delete to
proceed.

But when I try to check said values in Form_BeforeDelConfirm, it looks
like I'm seeing the values of the next record - as if the beginning of
the Delete process forced a Form_Current.

..OldValue doesn't seem to help.

Anybody been here?
 
D

Dirk Goldgar

PeteCresswell said:
When the user clicks "Delete" on a subform, I want to do some checking
against values of the record tb deleted before allowing the delete to
proceed.

But when I try to check said values in Form_BeforeDelConfirm, it looks
like I'm seeing the values of the next record - as if the beginning of
the Delete process forced a Form_Current.


Yes. By the time the BeforeDelConfirm event fires, the record has already
been deleted. It's done in a transaction, so if you decide to cancel the
delete, it can be rolled back. If you look at what happens visually on the
form when you do a delete, you can see that the record has been deleted when
the delete-confirmation dialog pops up.

You can use the Delete event to capture values from the record(s) to be
deleted. The Delete event fires for each record deleted. You can cancel
the Delete event to prevent the record from deleted, or you can store the
information in module-level variables, to be examined later. Be aware that
users can delete more than one record at a time, so you have to be prepared
to handle multi-record deletes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top