cancle db action set column value via macro Tom Schindl How can I cancle a database action

I have to problem that I want to cancle the delete opertion of an user and overwrite it with

an update statement which sets a delmark. The column which is set to one if the entry is deleted

is named delmark

First of all make sure that you are filtering the data by setting the filter property to "delmark = 0".

Please note that you have to use the filter property when directly appending the delmark = 0 in

the where clause of the SQL-Statement will result in an error.

' event handler which cancles the event Function MainFormBeforeDeleteHandler( Event As Object ) Dim FormObj Dim DelmarkFieldObj FormObj = ThisComponent.DrawPage.Forms.GetByIndex(0) DelmarkFieldObj = FormObj.GetbyName("delmark") _SetDelmarkInsteadOfDelete( FormObj, DelmarkFieldObj ) MainFormBeforeDeleteHandler = false End Function ' Event handler which cancles the event Function SubFormDebitBeforeDeleteHandler( Event As Object ) _SetDelmarkInsteadOfDelete4SubForms( "DebitDirectly", "delmark" ) SubFormDebitBeforeDeleteHandler = false End Function ' Set the delmark-column to a 1 Sub _SetDelmarkInsteadOfDelete( Form As Object, DelmarkField As Object ) DelmarkField.BoundField.updateShort( 1 ) Form.UpdateRow() Form.reload() End Sub ' This sub is working onto table control which are often used ' in sub-forms Sub _SetDelmarkInsteadOfDelete4SubForms( Form As String, DelmarkField As String ) Dim FormObj As Object Dim DelmarkFieldObj As Object ' Get the $Form-form FormObj = ThisComponent.DrawPage.Forms.GetByIndex(0).GetByName(Form) ' Get the $DelmarkField DelmarkFieldObj = FormObj.GetbyName("TableControl").GetbyName(DelmarkField) _SetDelmarkInsteadOfDelete( FormObj, DelmarkFieldObj ) End Sub
Initial version