title: Item cannot be found in the collection corresponding to the requested name or ordinal in access
body: <pre><code>Private Sub SupplierID_AfterUpdate()
  On Error GoTo errHandler
  
      Dim rs As ADODB.Recordset
  
      Dim cmd As ADODB.Command
  
      Set rs = New ADODB.Recordset
  
  
  
      ID = IIf(IsNull(DMax("ID", "PurchaseOrders")) = True, 1, DMax("ID", "PurchaseOrders") + 1)
      OrderDate = Date
      'saveFlag = False
  
      CurrentDb.Execute "DELETE * FROM tempOrders", dbFailOnError
  
  
      rs.Open "SELECT ([Products.PRCODE]), ([ProductsPriceList.SID]), ([Products.PRODUCT]), ([Products.SIZE]), ([Products.PACK]), ([ProductsPriceList.PRICE]) FROM Products INNER JOIN ProductsPriceList ON Products.PRCODE = ProductsPriceList.PRCODE  ", CurrentProject.Connection, adOpenStatic, adLockReadOnly
  
      While rs.EOF = False
  
          Set cmd = New ADODB.Command
  
          With cmd
              .ActiveConnection = CurrentProject.Connection
              .CommandType = adCmdText
  
                  .Parameters.Append .CreateParameter("p1", adVarChar, adParamInput, 100, rs.Fields("PRCODE"))
                  .Parameters.Append .CreateParameter("p2", adInteger, adParamInput, 10, rs.Fields("SID"))
                  .Parameters.Append .CreateParameter("p3", adVarChar, adParamInput, 100, rs.Fields("PRODUCT"))
                  .Parameters.Append .CreateParameter("p4", adVarChar, adParamInput, 100, rs.Fields("SIZE"))
                  .Parameters.Append .CreateParameter("p5", adVarChar, adParamInput, 100, rs.Fields("PACK"))
                  .Parameters.Append .CreateParameter("p6", adCurrency, adParamInput, 10, rs.Fields("PRICE"))
  
                  strSQL = "INSERT INTO tempOrders(PRCODE, SID, PRODUCT,SIZE,PACK,PRICE) VALUES(p1, p2,P3,P4,P5, p6)"
  
  
  
  
  
              .CommandText = strSQL
              .Execute
          End With
          Set cmd = Nothing
  
  
  
  
  
          rs.MoveNext
      Wend
      rs.Close
  
      Set rs = Nothing
  
      PurchaseOrders_subform.Form.RecordSource = "SELECT * FROM tempOrders ORDER BY PRODUCT"
  </code></pre>
  
  <p>The above code has given the error of "Item cannot be found in the collection corresponding to the requested name or ordinal in access"</p>
  
  <p>Thank you very much for your time</p>