I am missing the total concept of recordsets and how to manipulate them. Have read numerous books and have not found an explanation of how to extract one record from a recordset and relocate it to an empty table. If anyone knows of a book that puts the techniques into understandable language, please advise. What I am trying to achieve is to have a form that someone can enter many different workorder numbers into – then they press the command button and it will go through each number, one at a time, processing all the data and printing a batch or workorders. The following code is as far as I have gotten – I am stuck!! I have also attached a one form, one table database to demonstrate.
Private Sub Command1_Click()
Dim dbs As Database, rstWorkorderNumber As Recordset
Dim strWonum As String
Set dbs = CurrentDb
Set rstWorkorderNumber = dbs.OpenRecordset(“WorkorderNumber”)
DoCmd.OpenForm “frmWkorderNum”
DoCmd.Maximize
Do
rstWorkorderNumber.MoveFirst
strWonum = rstWorkorderNumber!Wonum
‘=================================================================
‘ What I wish to do is to eliminate the following message box and
‘ instead move the recordset, (strWonum) via code to a temporary
‘ table. Then I will try to create all the code so I can use
‘ that record to generate the reports for that workorder number.
‘ There will be many tables, many queries and many separate reports
‘ utilized for each workorder number.
‘==================================================================
MsgBox “The workorder number being processed is:” _
& strWonum, vbOKOnly, “Rons Message Box!”
rstWorkorderNumber.Delete
DoCmd.Requery
If rstWorkorderNumber.RecordCount = 0 Then
MsgBox “There are no more workorders to process”
Exit Do
End If
Loop While rstWorkorderNumber.RecordCount > 0
DoCmd.Close acForm, “frmWkorderNum”, acSaveNo
rstWorkorderNumber.Close
Set dbs = Nothing
End Sub