Deleting records

I use the Datasheet all the time for accounting purposes; it fantastic, but the danger I find is that I can unwittingly delete a record (by clicking on a selected field and pressing the Delete key) when I wanted to delete the data in a field (i.e. by double clicking on the selected field and pressing the Delete key). There is no warning when deleting records e.g. a Warning! dialog “Delete Record OK?”

Can I write a procedure so that if I delete a record in the Datasheet a warning dialog appears for me to approve the deletion.

Create a procedure named exactly .DeleteRecord

Enter something like:

If info("Modifiers") notcontains "option"
    Beep alertcanceldelete "Are you sure you want to DELETE this record?"   
    If info("DialogTrigger") ≠ "Delete"
	    Stop
    EndIf
EndIf
DeleteRecord

The procedure will run every time you try to delete a record, except if the deletion is via a procedure.

Thank you James, the procedure works properly.

Much appreciated.

You may have realized it, but I failed to point out that as I wrote it, if you want to deliberately delete a record, holding the Option key deletes without the interruption of the confirmation dialog.

Thank you James. Just what I needed.