You can do that in a Query quite easily by using a "Numbers table". Create a table named [Numbers] in your database consisting of a single field named [n] that has a field type of Numeric (Long Integer)
. Create rows in that table with values 1, 2, 3, ... up to a number that well exceeds the largest value you ever expect to see in [tblCustomer].[SumofQty]. In my test I used 2500, so my [Numbers] table looks like
n
----
1
2
3
...
2499
2500
Then, for sample data in table [tblCustomer]
ProductID Name Expire date SumofQty
--------- ----- ----------- --------
3 Flour 2013-12-13 6
6 Meat 2014-01-20 10
the query
SELECT tblCustomer.*
FROM
tblCustomer
INNER JOIN
Numbers
ON Numbers.n <= tblCustomer.SumofQty
returns
ProductID Name Expire date SumofQty
--------- ----- ----------- --------
3 Flour 2013-12-13 6
3 Flour 2013-12-13 6
3 Flour 2013-12-13 6
3 Flour 2013-12-13 6
3 Flour 2013-12-13 6
3 Flour 2013-12-13 6
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
6 Meat 2014-01-20 10
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…