Hi Carmen,
You might try something like:
[pre]
********
*BOF
********
set multilock on
select the_account
lSuccess=CURSORSETPROP("Buffering", 5, "the_account")
select the_activity
lSuccess=CURSORSETPROP("Buffering", 5, "the_activity")
begin transaction
insert into the_account (field1, field2,field3) values (string1,string2,string3) && new parent record
insert into the_activity . . . && you might have a number of child rows
did_update = .T.
select the_account
the_message=""
did_update = tableupdate(1,.T.,"the_account")
if did_update = .F.
the_message = "Trigger Failed when updating the_account table"
endif
if did_update = .T.
did_update = tableupdate(1,.T.,"the_activity")
endif
if did_update = .F. .and. empty(the_message)
the_message = "Trigger Failed when updating the_activity table"
endif
if did_update = .T.
end transaction
wait window "Transaction committed successfully"
else
rollback
tablerevert(.T.,"the_account")
tablerevert(.T.,"the_activity")
wait window the_message
endif
*********
*EOF
*********
[/pre]
Remember that transactions require the parent and child table to be in the DBC. A persistent relationship should be defined between the parent and the child per the DBC. Also, referential integrity code should have been generated within the DBC to enforce RI between the parent and the child table. To be sure the RI code is run within the DBC, I would use the insert command as opposed to append. Insert is much more in line with SQL 92 standards and is more flexible than append which can immediately generate error instead of allowing the programmer to test for errors with the tableupdate command.
The code above is incomplete and has never been run with VFP to check syntax. It is provided only to give you some idea as to how you might check to see if your transactions where successfully committed or not.