access database- Need help on Updating records that are included in other updating records

  • Thread starter Thread starter Kevin993
  • Start date Start date
K

Kevin993

Guest
Greetings,

I have an access database which consists of 2 tables :

Table 1: Products

Table 2: Items

In the first table , I have these columns : 1- Name 2- Items 3-Products 4- Price

** Second column , in the above, is the list of Items (from table 2) that are used in each product.

** Third column , in the above, is the list of other products (from table 1) , except itself, that are used in each product.

In the second table , I have these columns : 1-Name 2-Price

Take a look at the example in the pictures :


1459757.jpg


1459760.jpg



" *1*2 " in the second picture means : Item with ID1 and Item with ID2. * is separator, as lines aren't allowed in cells.

Price of products is sum of all included items or / and products


I made an automatic updater program that can change and trace values of all involved records. For Example : If I update Price of item1 to 20 , because Item1 is used in product 1 , it should update product 1 price as well : 30

and because item 1 and product 1 are used in the second product , it should change price of product 2 as well : 40

SO far, it was possible for me to make such a program and it works well.

But what if 2 products are used in each other. For example , Imagine, there is a third product that uses the second product and the second product that uses the third product. If I want to update each of these prices, there seems to be an infinite loop.

My problem isn't with how to code the program , but it is about the generic/ rational calculation procedure I should follow to do so, Then I can code my program to do the procedure.

** and Also imagine a scenario in which only a single item's price is updated and that item is included in all those 3 products (and products are used in each other ...) What would happen ?

Continue reading...
 
Back
Top