title: How do you prevent repeated MsgBox firing in the Form_Delete event?
body: <p>I have a datasheet form which is making it easy for users to select all records and delete. I thought of writing a VBA code that prevents users from deleting the records if more than 20 records are selected. Then I wrote this code but the problem is that the message fires for every record. Has someone ever come across this? Please see below.</p>
  
  <pre><code>  Private Sub Form_Delete(Cancel As Integer)
    If Me.SelHeight &gt; 20 Then
        Cancel = True
        MsgBox ("Bulk deletion is not allowed!")
   End If
   End Sub
  </code></pre>