how to repeat a row from 1 until N

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table of Shipment Detail. containing: doc no. , item no. , qty.
I need to make a query :
:::doc no. - item no - carton count - qty

carton count is 1 to [qty]
so the query will show more or less:
table:
doc no. - item no. - qty
OR.011 - PC.H18 - 5

query:
doc no. - item no - carton count - qty
OR.011 - PC.H18 - 1 - 5
OR.011 - PC.H18 - 2 - 5
OR.011 - PC.H18 - 3 - 5
OR.011 - PC.H18 - 4 - 5
OR.011 - PC.H18 - 5 - 5

how to make this. thank you.
 
I have a table of Shipment Detail. containing: doc no. , item no. , qty.
I need to make a query :
:::doc no. - item no - carton count - qty

carton count is 1 to [qty]
so the query will show more or less:
table:
doc no. - item no. - qty
OR.011 - PC.H18 - 5

query:
doc no. - item no - carton count - qty
OR.011 - PC.H18 - 1 - 5
OR.011 - PC.H18 - 2 - 5
OR.011 - PC.H18 - 3 - 5
OR.011 - PC.H18 - 4 - 5
OR.011 - PC.H18 - 5 - 5

how to make this. thank you.

One handy way is to use an auxiliary table. Create a table named NUM with one
integer field N; fill it with values from 1 to the maximum qty you'll ever
need (be generous, a 10000 row table is still tiny).

Create a query including Shipment Detail and Num with *no* join line. Put a
criterion on N of

<= [Shipment Detail].[qty]

and use N as your carton count.

John W. Vinson [MVP]
 
Back
Top