> Hi
>
> When a user presses Delete key to delete a record, I need to check the
> value of one of the record fields on the form and depending on the value I
> need to allow or not the deletion of record to go ahead. What form event
> should I use for this purpose?
I think it's the form's Delete event that you want for this. You can cancel
it to prevent a record from being deleted, and I think in this event the
current record whose fields you can interrogate is the record that is about
to be deleted. (I'm not sure about the BeforeDelConfirm event, and that
won't not fire if the user has delete confirmations turned off.) Also, if
multiple records are selected for deletion, the Delete event fires for each
of them.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Dirk Goldgar - 14 Jan 2008 03:00 GMT
> I think it's the form's Delete event that you want for this. You can
> cancel it to prevent a record from being deleted, and I think in this
> event the current record whose fields you can interrogate is the record
> that is about to be deleted. (I'm not sure about the BeforeDelConfirm
> event, and that won't not fire if the user has delete confirmations turned
> off.)
Err, I meant "won't fire", not "won't not fire". And I just checked, and in
the Before DelConfirm event, the values of the form controls are for the
residual record *after* the record(s) have been deleted. So Delete looks
like a better event for your purpose.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
You need a cancellable event. BeforeDelConfirm comes to mind.
-Tom.
>Hi
>
[quoted text clipped - 6 lines]
>
>Regards