Run-Time Error 3265 Item not found in this collection

I added these below code to a procedure that I have. This procedure applies text to fields for records that are selected.
Basically copies information from one record to other records that need the same data in the two fields I added.

 qdTMMK.Parameters(11) = Me.ToyotaRank
            qdTMMK.Parameters(12) = Me.QreRank

Open in new window

I'm getting the "Run-Time Error 3265 Item not found in this collection"

Any ideas where I need to look?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

ggodwinConnect With a Mentor Author Commented:
I actually found this one on my own.

The new field/form parameters that I entered had to be included in
the query. "qryUpdateQreValue_TagNumber".

Complete oversight on my part
ggodwinAuthor Commented:
Here is the entire function

Sub CopyMultipleQrevalueTMMK_SelectByTagNumber()
Dim rsTMMK As DAO.Recordset
Dim qdTMMK As QueryDef
Dim reccountTMMK As Long
Dim copycountTMMK As Long
Dim msgStringTMMK As String
Set rsTMMK = Me.qQreValueTMMKVEHSubform.Form.RecordsetClone
If Not ((rsTMMK.BOF) And (rsTMMK.EOF)) Then
    reccountTMMK = rsTMMK.RecordCount
    Debug.Print reccountTMMK & " records in subform"
    For ctr = 1 To rsTMMK.RecordCount
        If rsTMMK.Fields("Select") = True And rsTMMK("tagNumber") <> Me.TagNumber Then
            copycountTMMK = copycountTMMK + 1
            Debug.Print "*** Copying details to SKPI with Tagnumber " & rsTMMK.Fields("tagNumber")
            Set qdTMMK = CurrentDb.QueryDefs("qryUpdateQreValue_TagNumber")
            qdTMMK.Parameters("strTagNumber") = rsTMMK.Fields("tagNumber")
            'Fill in the form-based params
            qdTMMK.Parameters(1) = Me.ProblemDescription
            qdTMMK.Parameters(2) = Me.HowFound
            qdTMMK.Parameters(3) = Me.QREConfirmation
            qdTMMK.Parameters(4) = Me.InterimAction
            qdTMMK.Parameters(5) = Me.QualitAlertNumber
            qdTMMK.Parameters(6) = Me.SortedQuantity
            qdTMMK.Parameters(7) = Me.SortRejects
            qdTMMK.Parameters(8) = Me.[SortCompletion Date]
            qdTMMK.Parameters(9) = Me.SortYesNo
            qdTMMK.Parameters(10) = Me.DateCode
            qdTMMK.Parameters(11) = Me.ToyotaRank
            qdTMMK.Parameters(12) = Me.QreRank

'            For x = 0 To qdTMMK.Parameters.Count - 1
'                Debug.Print x; qdTMMK.Parameters(x).Name & vbTab & vbTab & qdTMMK.Parameters(x).Value
'            Next
            Set qdTMMK = Nothing
        ElseIf rsTMMK("tagNumber") = Me.TagNumber Then
            Debug.Print "Skipping TagNumber" & rsTMMK("tagNumber") & " because it is the record being edited in the main form."
        End If

Open in new window

Rey Obrero (Capricorn1)Commented:
which line is highlighted when you get the error?
Dale FyeCommented:
the parameters collection is zero based, so you probably need to change the values of each of the parameter indices (0-11), or use the actual name of the parameter:

qdTMMK.Parameters("ProbDescription") = me.ProblemDescription
ggodwinAuthor Commented:
found on my own
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.