CREATE CURSOR t1 ( f1 I )
=CURSORSETPROP("Buffering", 5, "consulta") && the most import thing in transacions
APPEND BLANK
replace f1 WITH 1
IF THISFORM.Check_data()
****/ if check is fine /*******
IF THISFORM.tables_save()
****/ if save is fine /*******
****/ do something to restore your form to original state /***
ELSE
***/ if something was wrong /*****
****/ check what happen or revert /****
IF MESSAGEBOX('Do you want to revert?.',4+32)=6
THISFORM.tables_revert()
****/ do something to restore your form to original state /***
ENDIF
ENDIF
ELSE
MESSAGEBOX('f1 i empty you must to type something?.',0)
ENDIF
PROCEDURE Check_data()
**********/ check if all values have been typed /********
IF ALL IS fine
RETURN .T.
ELSE
RETURN .F.
ENDIF
ENDPROC
PROCEDURE tables_revert()
=table_revert(.T.,.T.,'t1'))
****/ return your table to the orginal state /***
ENDPROC
PROCEDURE tables_save()
*****/ The transaction is the last step /***********
****/ when alway is fine /**********
BEGIN TRANSACTION
IF NOT (table_update(.T.,.T.,'t1'))
ROLLBACK && this not rollback the inserted record
****/ check what happen or revert /****
ELSE
END TRANSACTION
ENDIF
END TRANSACTION
ENDPROCCarlos A. Miranda
E.I.S.lnc
President