Here is my DB and these forms: “Acteurs”, “Actrices” and “FilmsSeries”.
,
.
Here is the “FilmsSeries” form and its 3 main forms: “frm-FilmsSeries”, “frm-Filtre”. “WDSettings”
.
.
Here, the “Acteurs” form and its 3 main forms: “frm-Acteurs”, “frm-Filtre”. “WDSettings”
.
.
Finally, the “Actrices” form and its 3 main forms: “frm-Actrices”, “frm-Filtre”. “WDSettings”
.
.
In a Basic procedure, these two lines of code are used:
.
oElement = ThisComponent.DrawPage.Forms.ElementNames
sElement = oElement(0)
.
oElement (object variable) places the list of elements corresponding to the names of the three main forms of each of the forms in the database according to the open form.
sElement (text variable) sets the corresponding form name to ElementNames(0).
For each form it looks like this:
Form 1 (Acteurs): “frm-Acteurs”, “frm-Filtre”. “WDSettings”
.
Form 2 (Actrices): “frm-Actrices”, “frm-Filtre”. “WDSettings”

.
Form 3 (FilmsSeries): “frm-Filtre”, “frm-FilmsSeries”, “WDSettings”

.
For the (Acteurs) and (Actrices) forms, in the form’s ElementNames variable, the ElementNames(0) or oElement(0) corresponds to “frm-Acteurs” and “frm-Actrices” respectively. However, for the (FilmsSeries) form, the ElementNames(0) corresponds to “frm-Filtre”.
For what reason in the form “FilmsSeries”, the form “frm-Filtre” is considered to be ElementNames(0)? However, in all three forms, the main forms are arranged in the same order.
.
.
In the current situation, this requires me to use additional lines of code to check the name contained in the variable (sElement) and act conditionally, which I would not have to do if the ElementNames(0) or sElement was either: “frm-Acteurs”, “frm-Actrices” or “frm-FilmsSeries”.
Is there a way to ensure that for the form (FilmsSeries), the ElementNames(0) or sElement may = “frm-FilmsSeries” and not “frm-Filtre”?
What determines the order of forms and subforms as part or element of a form?