Master-Detail Form Filter or Control

Hi,
Could anyone please tell me if this is possible (and how). I have a Master-Detail form and I need to control the content that can be selected in the detail part of the form.

The master contains a field “supplier” which looks up data from a table “company” and saves the data in a table called “order”.

The detail contains a field “product” which looks up data from a table “materials” and saves the data in a table called “order_detail”

At present the field “product” lists all of the entries in the “materials” table. I want to be able to restrict the list to only the products offered by the value selected in the “supplier” field.

The “materials” table also contains a field “supplier” where it stores the same value as the field “supplier” in the “company” table.

Re: Master-Detail Form Filter or Control

Show us your order and order_Detail talbe structure.

Re: Master-Detail Form Filter or Control

[table][tr]
[td]order (Master)[/td][td]order_detail (Detail)[/td][td]materials[/td][td]company[/td]
[/tr]
[tr]
[td]po_id[/td][td]order_detail_id[/td][td]mat_supply_id[/td][td]supplierid[/td]
[/tr]
[tr]
[td]po_date[/td][td]po_id[/td][td]product[/td][td]supplier[/td]
[/tr]
[tr]
[td]supplierid[/td][td]mat_supply_id[/td][td]unit_desc[/td][td]address1[/td]
[/tr]
[tr]
[td]supplier[/td][td]product[/td][td]quantity_per_unit[/td][td]address2[/td]
[/tr]
[tr]
[td]po_issuer[/td][td]unit_desc[/td][td]cost_unit[/td][td]city[/td]
[/tr]
[tr]
[td]po_status[/td][td]quantity_per_unit[/td][td]supplier[/td][td]county[/td]
[/tr]
[tr]
[td]total_order_value[/td][td]cost_unit[/td][td] [/td][td]pcode[/td]
[/tr]
[tr]
[td] [/td][td]order_quantity[/td][td] [/td][td] [/td]
[/tr]
[tr]
[td] [/td][td]item_order_cost[/td][td] [/td][td] [/td]
[/tr]
[/table]

The link fields are po_id, mat_supply_id and supplierid

Hope this helps make it a little clearer

Many Thanks

Re: Master-Detail Form Filter or Control

You could do something like this, in the form oder_detail, edit the lookup of the field product to:

SELECT
product,
unit_desc
FROM
materials
WHERE
supplier = ‘[var_supplier]’

Now, re-edit the link between the order to order_detail, should open a new parameter to pass to order_detail called var_supplier … passe the field supplier from order and test.

I dont know exactly if is this fields that you want in the sql statement … but im trying to teach you how to pass a parameter … so you can modify for your needs.

Re: Master-Detail Form Filter or Control

Brilliant, Thank you very much it works perfectly,

Now I know how to pass a parameter for future.

Much appreciated.

Re: Master-Detail Form Filter or Control

:slight_smile: