Ok,
I figured out how to get the values into the Temp Table using VBA on my form (as a Module).
Just incase someone else can get some use from my code, here it is.
Code:
Sub CreateWONos()
Dim strSQL As String
Dim NoOfWO As Integer
Dim i As Integer
Dim Lnum As Integer
Dim NewWOno As String
'Extract the last 3 numbers from the Work Order Number in order to increment the
'number for creating the next Work Order Number.
Lnum = Right(Forms!qry_WO_WOLast!LastOfWO_WorkOrderNo.Value, 3)
'Extract the first 4 Numbers/Letters of the Work Order Number to that it
'can be concatenated to the generated Lnum.
NewWOno = Left(Forms!qry_WO_WOLast!LastOfWO_WorkOrderNo.Value, 4) & Lnum
'Gets the current WO Number from the query.
NoOfWO = Forms!qry_WO_WOLast!txtNoOfWO.Value
'Initialize the first number of the iteration
i = 0
'Loop while the iterations is equal to the number typed into the form box.
Do While i < (NoOfWO)
'Increment the iteration
i = i + 1
'Concatenate the WO Number to be inserted into the Temp Table.
NewWOno = Left(Forms!qry_WO_WOLast!LastOfWO_WorkOrderNo.Value, 4) & Lnum + i
'SQL Statement to insert the newly generated WO number.
strSQL = "Insert into TempWO (TempWO_WONumber) Values( " & "'" & NewWOno & "')"
'Prevent the "Insert Row" warning from coming up for each iteration
DoCmd.SetWarnings False
'Execute the SQL Statement to insert the row.
DoCmd.RunSQL strSQL
Loop
'Set the Warnings back on.
DoCmd.SetWarnings True
End Sub
Now I need to use these numbers (in the new table) in a report so that the Work Order Numbers can be Printed.
Once the Work Orders are completed, they will select those available Work Orders in order to insert the rest of the data in the main table. And then the Work Order number used will be removed from the temp table. Hopefully, this will prevent orphaned Work Order Numbers.
I will post more as I progress, but still looking for easier solutions.
Thank You
Terry