Form and Subform Linkage

  • Thread starter Thread starter Rafael Chemtob
  • Start date Start date
R

Rafael Chemtob

Hi,
I have a form within a form (subform). on the main form, there is a list
box reading from the products table (fields, id_product, product_name). on
the subform, i have a list box reading from the orders table. the subform
shows the customers who ordered the product.
What I want to do is link the 2 forms so when I click on the main form's
product, the subform will show all the customers that ordered that product.
It's a simple linkage between the 2 forms, but I'm just not sure how to do
that.

please advise.
rafael
 
Hi
1) You may have a design issue - classicaly, the products
to order relation needs an additional table, as a product
can be ordered 1 or may times, and an order can be for 1
or many products - consider a link table
2) If have the relation correct, an auto form will do
what you ask automatically - try that, then see if you
can take that and customize it to your needs.
 
the common ('linking') field between the form and subform (ID_Product, in your case) needs to be in the data source underlying both forms. In the parent form, open the properties for the sub-form, and look for 'Link Child Fields' and Link Master Fields' This is where you designate the specific field names from the Products Table and the Orders Table which represent the id-product in both tables.
 
This one is thankfully relatively easy to do
The base form you have must be built on a query/table with the linkable data
(i.e. Product Id)

The subform must be based on a query that has the productId & CustomerName
and ID .. make sure you've set that into continuous form view.. so you can
display multiple records.

The linkage between them will be based on the Product Id

Now when you select something from the list box, all you have to do is make
sure that the form's current record is set to that productID.. findFirst
with Bookmark should do that.
 
Back
Top