G
Guest
I have a table containing nine part numbers called TestParts, and an empty
table called TestOutput. I need a loop that takes the first part number from
TestParts and puts it in TestOutput, then moves to the next part number in
TestParts and does the same thing. The loop continues while Not
TestParts.EOF This is what I have so far, but obviously it doesn't quite
work. I'm new at this so any help would be greatly appreciated!
Public Function vAppendPartNumbers()
Dim rstTestParts As Recordset
Dim rstTestOutput As Recordset
Set rstTestParts = CurrentDb().OpenRecordset("TestParts")
Set rstTestOutput = CurrentDb().OpenRecordset("TestOutput")
With rstTestParts
If .RecordCount = 0 Then
MsgBox "No Records To Process"
Else
DoCmd.OpenQuery ("TestQueryDelete")
rstTestParts.MoveFirst
While Not rstTestParts.EOF
rstTestParts.Edit
rstTestParts![PartNumber] = g_strPartNumber
rstTestOutput.AddNew
rstTestOutput.Update
rstTestParts.MoveNext
Wend
.Close
End If
End With
Set rstTestParts = Nothing
End Function
table called TestOutput. I need a loop that takes the first part number from
TestParts and puts it in TestOutput, then moves to the next part number in
TestParts and does the same thing. The loop continues while Not
TestParts.EOF This is what I have so far, but obviously it doesn't quite
work. I'm new at this so any help would be greatly appreciated!
Public Function vAppendPartNumbers()
Dim rstTestParts As Recordset
Dim rstTestOutput As Recordset
Set rstTestParts = CurrentDb().OpenRecordset("TestParts")
Set rstTestOutput = CurrentDb().OpenRecordset("TestOutput")
With rstTestParts
If .RecordCount = 0 Then
MsgBox "No Records To Process"
Else
DoCmd.OpenQuery ("TestQueryDelete")
rstTestParts.MoveFirst
While Not rstTestParts.EOF
rstTestParts.Edit
rstTestParts![PartNumber] = g_strPartNumber
rstTestOutput.AddNew
rstTestOutput.Update
rstTestParts.MoveNext
Wend
.Close
End If
End With
Set rstTestParts = Nothing
End Function