• Item not found (possible corruption?) (A2k)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Item not found (possible corruption?) (A2k)

    Author
    Topic
    #442284

    I’m receiving the error “Item not found in this collection” when running the following:

    Private Sub CmdAddRecord_Click()

    Dim db As DAO.Database
    Dim rst As DAO.Recordset

    On Error GoTo ErrHandler
    Set db = CurrentDb
    Set rst = db.OpenRecordset(“tblData”)
    With rst
    rst.AddNew
    rst!SURVEY_ID = ID
    rst!QUESTION = “Q1”
    rst!Comments = Q1

    I have verified the following:

    tblData exists

    The fields [SURVEY_ID], [ question], and [COMMENTS] are fields in the table “tblData”, and

    ID and Q1 are fields on the form.

    Any suggestions?

    Viewing 1 reply thread
    Author
    Replies
    • #1064193

      which line of code does the program bomb on?

      • #1064216

        It’s funny – it doesn’t take me to the VBE to debug…just error and Ok only.

    • #1064201

      What happens if you remove the ‘with rst’ line?

      You don’t need it, as the next 4 lines all starts with rst.

      • #1064217

        Same error.

        • #1064218

          Which line is it breaking on, Jeremy? Put a breakpoint in your code and step through until you find the exact line.

          • #1064226

            I had an (arguably) temporary moment of idiocy. I had misspelled a field. All is well now. Thank you for looking at this

    Viewing 1 reply thread
    Reply To: Reply #1064193 in Item not found (possible corruption?) (A2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel