BeforeInsert Event Example

This example displays a message that asks the user to confirm the addition of a new record.

Private Sub DataGrid1_BeforeInsert (Cancel As Integer)
   Dim mResult As Integer
   mResult = MsgBox("Confirm: Add a new record?", _
    vbYesNo And vbQuestion, "Confirmation")
   If mResult = vbNo Then Cancel = True
End Sub