update 2 records in subform

pacgoncalves

Registered User.
Local time
Today, 11:06
Joined
Jul 3, 2001
Messages
13
1 car have N pieces.
1 piece is in N cars.
I have 1 table for register the cars bilt and here i must have to update the records Wheels = -4, windows =-4,...
Thanks
 
Hi pacgoncalves

I am not too sure what your question is about, but perhaps it is on the topic of many-to-many relationships.

Access normally allows tables to have a one-to-many or a one-to-one relationship between two tables. In the situation of car parts you can put one type of part in many different cars (though the actual part can only be fitted to one specific car) and a car has many parts within it.

To create a many-to-many relationship you need three tables - tblPart, tblCar and tblFittedIn.

tblCar has a one-to-many relationship with tblFittedIn. tblPart has a one-to-many relationship with tblFittedIn. tblFittedIn has at least two fields, CarID and PartID (the Primary Keys from the other two tables),in each record. This enables a part type to be fitted in many cars and a car to be fitted with many part types.

Having explained that, now tell me your question was on something completely different!

HTH

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 07-18-2001).]
 
Thats correct Rich.
I already done that.
I have a form(table) to register the number of car made in one day that its linked to my table cars.
My problem its that when - in this form - i put 3 cars i want that in the table of pieces (like you explained) it will update the record of the wheels = -4 ...
Thanks.
Pedro
 
Hi Pedro

Unfortunately you still have me confused ... how is it that four cars made in one day results in -4 wheels? Can anyone else see what Pedro is trying to achieve here?

Rich Gorvin
 
Hi Rich
I'm sorry.
Example: 3 cars are made then in the field wheels = - (4 wheels) * 3(cars)...
I am using 4 tables in this, with this structure (the letter T is for Tables):
T_carsmade N - 1 T_CARS 1 - N T_carpieces N - 1 T_PIECES
This is the real structure in Access.

1. From the start : N cars are made in one day;1 car needs N pieces and 1 piece is in N cars.Ok!
2. I have a form (F_cars made) to register the number of cars that are made and to update the number of cars in stock (T_CARS)
3. In the form F_cars made i have a subform that makes the relation between the cars and the pieces. In the form i have the type of cars made and in the subform i have all the pieces that are need for that particular car.
4. My problem is: i have one botton that validates the number of cars made (prints a paper) in that day and to update all the fields in the subform but it only updates the first record ( for examp. the record of the windows...). In my code i'm looking first for the field that has the ID of the car and than the field with the ID of the piece. I need that it will pass to the second record and so.
Thanks Rich or any who can help on this.
p.s. Rich we can't never explaine correctly the problems.
smile.gif
 

Users who are viewing this thread

Back
Top Bottom