Master-Detail Forms with Many to Many relationships

E

ECathell

I have 3 tables in a Many to Many relationship.

Recipe
RecipeDetail
Ingredients

Recipe detail has 3 fields:RecipeID,IngredientID,Ingredient Count

How do I setup my master detail form to handle this? Most of the tutorials I have seen deal with a singel parent-child relationship. I want to see the ingredients and the count of each within the detail form.
 
F

Frans Bouma [C# MVP]

ECathell said:
I have 3 tables in a Many to Many relationship.

Recipe RecipeDetail Ingredients

Recipe detail has 3 fields:RecipeID,IngredientID,Ingredient Count

How do I setup my master detail form to handle this? Most of the
tutorials I have seen deal with a singel parent-child relationship. I
want to see the ingredients and the count of each within the detail
form.

As the m:n relation is an objectified relation (i.e.: the intermediate
table is used as a separate entity), the setup is master - detail and
then a view of the ingredient chosen, as you have to use the
intermediate entities (RecipeDetail). As recipeDetail has an m:1
relation with Ingredients, the ingredients aren't viewable in a grid.

So master is Recipe, then you have a detail view for that current
recipe, in which you show RecipeDetail. For the selected recipe detail
you show the related ingredient in labels or textboxes below that.

You can also opt for a master-detailed view but hten you have to join
the ingredient with recipe detail and show the join result in the
detailed view.

Frans

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top