Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Item not found (possible corruption?) (A2k)

    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?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Item not found (possible corruption?) (A2k)

    which line of code does the program bomb on?

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Item not found (possible corruption?) (A2k)

    What happens if you remove the 'with rst' line?

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



  4. #4
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Item not found (possible corruption?) (A2k)

    It's funny - it doesn't take me to the VBE to debug...just error and Ok only.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Item not found (possible corruption?) (A2k)

    Same error.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Item not found (possible corruption?) (A2k)

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

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Item not found (possible corruption?) (A2k)

    I had an (arguably) temporary moment of idiocy. I had misspelled a field. All is well now. Thank you for looking at this [img]/forums/images/smilies/smile.gif[/img]
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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