I suspect there is no inherent difference between a sub-form based on a table and one based on a query. In each case, the underlying command is SQL: when based on a table it is the equivalent of 'SELECT * FROM TableName
', whereas when based of a query the fields in the SELECT statement are more specific.
sub-forms are in effect based on a 'parameter query'. An explanation can be found by entering “sub-forms,description” in the 'Index' tab of the Base help file
and scrolling down to the “Link Master Fields” sub paragraph:
The sub-form is based on an SQL query; more specifically, on a Parameter Query. If a field name is entered in the Link master fields box, the data contained in that field in the main form is read to a variable that you must enter in Link slave fields. In an appropriate SQL statement, this variable is compared to the table data that the sub-form refers to.
This means the links offered by the Base GUI between a data form and its sub-form can provide/add
extensive and highly flexible WHERE clauses that are applied to the SQL on which the sub-form is effectively based. Naturally, on most occasions a field name is simply entered in the Link slave field, but I suspect this is still treated as a variable whose value and name are compared to data in a matching field in the source for the sub-form.
I would greatly welcome correction or comment on any inaccuracies and/or over simplifications in my understanding of the sub-form as described above.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
OOo 4.1.1 on MS Windows XP MySQL and HSQLDB