pastim wrote:What I want to do is get this sub-form to use a value in the main form as the parameter.
What I want to do is get this sub-form to use a value in the main form as the parameter.
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.
Arineckaig wrote: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......
I would greatly welcome correction or comment on any inaccuracies and/or over simplifications in my understanding of the sub-form as described above.
I can only report what I found
Arineckaig wrote:That is indeed what should be expected when the SQL or Query contains a parameter and is to be parsed by the Base GUI to provide the data source for the sub-form: the parameter variable should be set in the slave link property so that its value will be supplied by the value of whatever field has been set in the master link property.
I had expected that using one of the attributes of the query, which was displayed as a control in the subform, as the slave field would work, without using an explicit parameter. It didn't
Arineckaig wrote:Somewhat surprising, but may depend on what may have been "one of the attributes of the query"! Normally, provided the record-set for the sub-form - whether sourced from table, query or SQL - contains a field whose data type matches the data type of a field in the record set of the parent form, then those two fields merely need to be shown as the respective slave and master linking field properties of the sub-form. I guess there must be some other explanation why such simple links should not have worked for you.
and never with a query
Arineckaig wrote:If you are using MySQL as the back-end, do you get the same failures whether the query is parsed by Base or issued directly to MySQL?
Users browsing this forum: No registered users and 1 guest