Results 1 to 2 of 2
  1. #1

    Item Not Found In This Collection ERROR

    I am desperately trying to figure out how to create a new record using "some" field values from the "CURRENT" record viewed on the active form for Access 97. I am getting the error message "3265 Item Not Found In This Collection" when I run the below code. I need a custom duplicate function. I have tried many of the variations previously posted here without any success. My form is feeding from a query named "fDataID". The main table is named "tData". The form name is "fData". The form has a bunch of text boxes and a few combo boxes and some unbound text boxes. The unique identifier is in the text box named "tbIDNumber". I need to copy the values from a few "bound" text boxes into a new record. Below is my code. Any help you can offer to fixing my problem will be greatly appreciated! Thanks!

    Private Sub bDup2_Click()
    On Error GoTo Err_bDup2_Click

    Dim db As DAO.Database
    Dim rs As DAO.Recordset

    Set db = CurrentDb
    Set rs = Me.RecordsetClone

    With rs
    !tbFirstName = Me!tbFirstName 'I am only testing one field till I get this right
    ' .Update 'I do not want to save the record
    End With

    Set db = Nothing
    Set rs = Nothing

    Exit Sub

    MsgBox Err.Number & " " & Err.Description
    Resume Exit_bDup2_Click

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Item Not Found In This Collection ERROR

    You don't add records to a recordsetclone, you add them to the form's recordset, and all you really need to reference is Me.recordset. You don't need the database object at all. Try this:

    <pre> Dim strName As String
    Dim rst As DAO.Recordset

    strName = Me!tblFirstName
    Set rst = Me.Recordset

    With rst
    !tbFirstName = strName
    End With

    Set rst = Nothing</pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts