No need for writing the delete query,the function works fine with OnRowChange mode.