I am using a Shape recordset opened as follows:
rsMain.Open cmd, , adOpenStatic, adLockBatchOptimistic, adCmdText
The database is MS-SQL. I am adding a child record as follows:
rsChild.addNew Array("fld1", "fld2", "fld3", "fld4"), _
Array(val1, val2, val3, val4)
rsChild.updateBatch
There is an on insert trigger in the underlying child table. Under some
conditions, the trigger generates an error message. I wish to "rollback" the
addNew when such a condition occurs. I am using the following error:
AddErr:
mResult = cn.Errors(0).NativeError & " : " & cn.Errors(0).Description
mResult = MsgBox(mResult, vbExclamation, "Insert Error")
rsChild.CancelBatch
The new line indeed disappears from the DataGrid attached to rsChild, but
the record does not disappear from the child table.
Could someone please help me resolving this problem.
Thanks,
Dan Kimhi