Hello, i change the code as you recommend and move to Row update, now work but i have a new problem now, every time i edit the record the sql trigger again and i need just add the records one time
$sql = “INSERT INTO contactunlink (id, removalarea)
SELECT employees.id, removalarea FROM employees, unlinkareas WHERE employees.id = '” . AdjustSql($id) . "’ " ;
if ($rsnew[“Discharge”] == “Yes”){ // move the record from “candidates” table into “employees” table, only if the new value of “Accepted” is equal to “Y” (meaning Yes)
// Row Updated event
function Row_Updated($rsold, &$rsnew) {
$id = $rsold[“id”];
$check_id = ExecuteScalar(“SELECT id FROM contactunlink WHERE id = '” . $id . “'”); // check the id in “contactunlink” table, assume it is string/varchar/char field type
if (empty($check_id)) { // if it does not exist
// execute your INSERT INTO SQL
$sql = “INSERT INTO contactunlink (id, removalarea) SELECT employees.id, removalarea FROM employees, unlinkareas WHERE employees.id = '” . AdjustSql($id) . "’ " ;
if ($rsnew[“Discharge”] == “Yes”){ // move the record from “candidates” table into “employees” table, only if the new value of “Accepted” is equal to “Y” (meaning Yes)
Execute($sql);
}
}