Spucelik
If you use the code that Peter referred to and changed the code “b.Comp_Item_no = ITEM” to reference the parent item number instead, the code will go up the find the initial parent item. The problem is that you will still have to enter the item numbers one at a time.
This brings us back to the business problem that is being addressed. There are only a few reasons that I would want to see all the parents created by a group of items.
1) Price of the raw material is expected to rise
2) Availability
3) Political (like a competitor bought the raw material supplier)
4) Boredom set in and I just wanted to know
The result of this thought process is that it should be possible to select the items from the existing database and load the query in a single pass. For example finding all the items from a specific supplier and loading that into code, like the code that was posted, is a single line. If you had a material cost type that was going up by 10% and you wanted to see the effect on the parent items that is also possible.
Contact your business partner – or post the real issue.
Tom