Appending one row at a time

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

Guest

I have a VBA that runs a query and appends the part numbers from one table to
another table. The VBA contains a loop that executes while not end of table.
I want to be able to append one row from the parts table at a time. Is this
possible?
 
Is it that you would like to interact, with the db, between each update? If
so, the simple solution would seem to be to remove the loop.

Sharkbyte
 
There are nine items in the part number table. When I run the VBA with the
loop, those nine items are appended nine times, for a total of 81 items in
the new table. Without the loop the nine items are all appended, but I want
to be able to just append one of the rows at a time, if this is possible?
BK
 
There is something wrong in your loop. You are not distinctly identifying
each row, and so it runs the append for all 9 records. Then, when it moves
to the next record, and cannot uniquely identify each record, it appends all
9 again; etc, until the loop completes.

You need to add a unique identifier, for each record, to the loop criteria.
This way the loop only process one record on each pass.

Sharkbyte
 
Thanks for the advice, I've been making progress but it still isn't
completely working, do you happen to have any specific examples of what to
add to the loop?
 
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

here is the loop, could the problem be with the query?
 
Back
Top