Forms and subforms have nothing to do with the error received. The error indicates a Foreign Key violation. If you have a Master table of “Company”, for example, and a secondary table with “Employees”, in this secondary table you would have a field of the company name relating back to the Master table “Company”. Now you can set a one-to-many relation from “Company” to “Employees” via the company name field.
Now if you enter a new “Employee” record with a company name which is not in the “Company” table you will generate the error.
EDIT:
One thing I dislike about Base is the different use of the word “Form”. When you create a new blank “Form” in Base then open it in edit mode then open Navigator on this blank “Form” you will see only a folder names “Forms” (This should be called Sections or something else). When you add anything to this blank page (controls), a Form (Section) with a name of Form
is created with the control under it. This can now have a single data source (i.e. table, query). By right clicking on “Forms” in Navigator you can add more of these Sections each with its own data source. However you cannot relate these data sources to each other for automation.
By right clicking on the first “Form” created you can create a “Form” (really a subForm) as a child to the “Form” and now this data source can be related to the data source in its’ Parent (“Form”) but doesn’t have to be. It could be just another data source.
Now all this may have confused you more (hopefully not), I always found it easier to understand by example so I attached one for you. Some Forms are just data entry (OILS, PROPERTIES, QUALITIES). On the top two you will find table controls. By selecting an item within the table on the left (or center) you will see items on the right change. Edit these forms use Navigator to see construction using forms, sub-forms and even sub_sub_forms. Also look at the properties of these forms and sub-forms.