I have three tables in my Microsoft access that stores the following data.
Wight table
tbl_weights
------------------------
Bill Number| Weight
1111 50
1112 60
1113 70
1114 30
The second table stores the pallets which were weighted:
tbl_pallets
------------------------
Pallet ID | Weighting Bill Number
ZM-001 1111
ZM-002 1111
ZM-003 1111
ZM-004 1112
ZM-005 1112
ZM-006 1113
The third table stores equipment data:
tbl_equipments
----------------------------
equipment ID | Pallets
O-001 ZM-001,ZM-002
O-002 ZM-003
O-003 ZM-003,ZM-004
The Pallets column is a multi-value field.
I need to calculate each equipment weight and store it on a table. How can I do that?
In a simple programming language, I would have a loop over each pallet in the tbk_equipments and search for the appearance of the corresponding pallet ID on the tbl_pallets then count the number of Weighting Bill Number and divide the corresponding weight for that bill number by the number of repetition of the bill number and then sum all of the resulted values to get the final answer. But I don't know how is the process in MS access.
I have tried "calculated fields" in the access but it does not allow me to have access to the fields on the other tables. I thought maybe there is a query or a function in VBA that I can use.
Thank you very much for your help.