I guess the explanation is: before filling the sub-form i need to fill the main form fields.
Yes, since a SubForm needs to be related to the MainForm via the
Link master fields and the
Link slave fields properties, the MainForm record must exist before anything on the SubForm can be related to it.
Based on the recent version you uploaded, when I open
TESTING FORM in the Edit/Desgn Mode and look at the Data page of the
Form Properties dialog for
SUB-FORM RECIPE, I see there are no values in the
Link Master fields and
Link Slave fields, which means the MainForm and SubForm are working independently of each other, explaining the odd behavior you are seeing.
When I try to select values for the
Link Master fields and
Link Slave fields I find there are no fields that could be used for this. That is where the intersection table comes into the picture.
Before making any changes, make a copy of
TESTING FORM so you can easily return to the starting point if needed.
Add a new SubForm to MainForm and use
TBL_DOSSIER_INT_RECIPE as the
Content property, then you can use "DOSSIER_ID" for
Link Master fields and "DossierID" as the
Link Slave fields. For now, add a table control to the new SubForm so you can display/edit the 3 fields in that table.
Using the
Form Navigator drag
SUB-FORM RECIPE so that it becomes a SubForm under the newly added SubForm, making it a SubSubForm . Then you can use "RecipeID" for the
Link Master fields and "ID_RECIPE" as the
Link slave fields in
SUB-FORM RECIPE.
This brings up a point that needs to be cleared up before going much further. The only way we can uniquely identity a particular recipe is by "ID_RECIPE". If you plan on re-using recipes (a many to many relationship between TBL_DOSSIER and TBL_RECIPES) the user would need to know "ID_RECIPE" number, which may not be realistic.
First question, do you actually need to reuse the recipes?
If so, is there more user friendly way to differentiate the recipes than the value of "ID_RECIPE"?
Unlike list boxes, Combo boxes do not have a boundfield. They store what they display so they are typically used with text fields.
To enter a new Pantone into
TBL_Pantoni_List will require a separate form. It could be incorporated in
TESTING FORM, but would need a separate MainForm.