E
EvilSewingMachine
I need to multiply records according to the [QNTY] field.
HOW!?
HOW!?
Maybe I over-simplified.
This database is a configurator based, manufacturing resource planner.
If you configure a product and then set [Qnty] to 2, I want a query
that creates 2 identical records.
example:
[Qnty=2]*PartA = PartA 1
PartA 2
One way to do this is to have a handy little utility table named Num with one
field N, filled with (say) 10000 records with values 1 to 10000. You can
create this set of records using Fill... Series in Excel and then import the
spreadsheet into a table.
Create a query by adding your parts table and Num, initially joining Qnty to
N. Then open the query in SQL view and edit
ON [yourtable].[Qnty] = [Num].[N]
to
ON [yourtable].[Qnty] >= [Num].[N]
John W. Vinson [MVP]
After importing the spreadsheet and linking Qnty and N.
SQL comes up with:
SELECT qry_CorniceFace.Qnty, tbl_Num.N
FROM qry_CorniceFace INNER JOIN tbl_Num ON qry_CorniceFace.Qnty =
tbl_Num.N;
I edit it:
SELECT qry_CorniceFace.Qnty, tbl_Num.N
FROM qry_CorniceFace INNER JOIN tbl_Num ON qry_CorniceFace.Qnty >=
tbl_Num.N;
It works great! my only problem....
I don't understand why it works, could you elaborate on the theory
behind the solution?
Now that I have a record for each individual
product, ( first step ) what if I wanted to break them down into their
4 parts and have an individual record for each part of the 4 part
assembly?
[Qnty] [Width] [Length] [Projection]Tbl_Specs
OrderID Qnty Width Length Projection
1 1 54 x 2 x 4
2 2 96 x 14.5 x 5.5
3 1 78.5 x 20 x 2
4 3 24 x 8 x 3.5This would be the desired output:
Rpt_PartList
PartID OrderID Width Length
1 1 52.5 x 3.5
2 1 12 x 3.5
3 1 12 x 3.5
4 1 54 x 12
5 2 96 x 5.5
6 2 14.5 x 5.5
7 2 14.5 x 5.5
8 2 97.5 x 14.5
9 2 96 x 5.5
10 2 14.5 x 5.5
11 2 14.5 x 5.5
12 2 97.5 x 14.5
13 3 78.5 x 2.5
14 3 20.75 x 2.5
15 3 20.75 x 2.5
16 3 80 x 20.75
17 4 24 x 3.5
18 4 8 x 3.5
19 4 8 x 3.5
20 4 24 x 8
21 4 24 x 3.5
22 4 8 x 3.5
23 4 8 x 3.5
24 4 24 x 8
25 4 24 x 3.5
26 4 8 x 3.5
27 4 8 x 3.5
28 4 24 x 8