OnDel event: avoiding delete

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

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