You need a new table (say tblDuplicates) to keep only the PNUMs.
Copy the code below in a standard code module:
Code:
Sub DuplicateRows()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Long
Set db = CurrentDb
db.Execute "DELETE * From tblDuplicates", dbFailOnError
Set rs = db.OpenRecordset("SELECT PNUM, QTY FROM tblOriginal", dbOpenForwardOnly)
With rs
If Not (.BOF And .EOF) Then
While Not .EOF
For i = 1 To Nz(!QTY, 0)
db.Execute "INSERT INTO tblDuplicates (PNUM) VALUES ('" & !PNUM & "')", dbFailOnError
Next i
.MoveNext
Wend
End If
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub
Create a query with that SQL statement:
Code:
SELECT tblOriginal.*
FROM tblDuplicates INNER JOIN tblOriginal
ON tblDuplicates.PNUM = tblOriginal.PNUM;
Run the procedure and open the query to check the results.
Wait for a better solution.
Cheers,
John