OnDel event: avoiding delete

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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 <--
 
Back
Top