G
Guest
I'm working on a VBA runs a query in a loop, and I need it to append one row
at a time from one table to another. There are nine items in the table, and
the loop executes nine times, as it should, but each of those times it
appends all nine of the items for a total of 81 items in the output table.
How can I change the loop so that it only does one row each time through, if
this is possible? Thanks
Public Function vAppendPartNumbers()
Dim rstTestParts As Recordset
Set rstTestParts = CurrentDb().OpenRecordset("TestParts")
g_strPartNumber = rstTestParts![PartNumber]
DoCmd.OpenQuery ("TestQueryDelete")
While Not rstTestParts.EOF
DoCmd.OpenQuery ("TestQuery2")
rstTestParts.MoveNext
Wend
rstTestParts.Close
Set rstTestParts = Nothing
Set g_strPartNumber = Nothing
End Function
at a time from one table to another. There are nine items in the table, and
the loop executes nine times, as it should, but each of those times it
appends all nine of the items for a total of 81 items in the output table.
How can I change the loop so that it only does one row each time through, if
this is possible? Thanks
Public Function vAppendPartNumbers()
Dim rstTestParts As Recordset
Set rstTestParts = CurrentDb().OpenRecordset("TestParts")
g_strPartNumber = rstTestParts![PartNumber]
DoCmd.OpenQuery ("TestQueryDelete")
While Not rstTestParts.EOF
DoCmd.OpenQuery ("TestQuery2")
rstTestParts.MoveNext
Wend
rstTestParts.Close
Set rstTestParts = Nothing
Set g_strPartNumber = Nothing
End Function