diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 20d566a20cd..842e935d641 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8512,7 +8512,7 @@ class Form
$sql .= " WHERE 1=1";
if (isset($objecttmp->ismultientitymanaged)) {
if ($objecttmp->ismultientitymanaged == 1) {
- $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
+ $sql .= " AND t.entity IN (" . getEntity($objecttmp->element) . ")";
}
if (!is_numeric($objecttmp->ismultientitymanaged)) {
$sql .= " AND parenttable.entity = t." . $tmparray[0];