OnDel event: avoiding delete

A

alekm

Hi,
I've got a subform that's in datasheet view. User can delete rows simply
selecting a row and clicking on del key. How can I prevent deleting if
certain conditions exists.
Is it ok for me to use "OnDel" event, to check conditions and if they are
fullfiled to exit "OnDel" somehow, canceling deletion?

thanx

alek_mil
 
S

Stefan Hoffmann

hi,
Hi,
I've got a subform that's in datasheet view. User can delete rows simply
selecting a row and clicking on del key. How can I prevent deleting if
certain conditions exists.
Is it ok for me to use "OnDel" event, to check conditions and if they are
fullfiled to exit "OnDel" somehow, canceling deletion?

Private Sub Form_Delete(Cancel As Integer)

If Condition Then
Cancel = -1 ' Don't delete.
Else
Cancel = 0 ' Do delete.
End If

End Sub


mfG
--> stefan <--
 
Top