Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Run-Time error '3265' Item not found in this collection

daveinchicago (IS/IT--Management) (OP)
16 Feb 12 12:03
If Not (Me.sfCategory.Form.Recordset.EOF And Me.sfCategory.Form.Recordset.BOF) Then
If MsgBox("Are you sure you want to Delete?", vbYesNo) = vbYes Then
CurrentDb.Execute "Delete from dbo_COMPLIANCE_CATEG " & _
"where ID=" & Me.sfCategory.Form.Recordset.Fields("ID")
End If
End If

I've got the above code tied to a button in Access 2010.  The subform is a SQL Table.  When I highlight a row in the subform (SQL Table) and hit the 'delete' button, the row should delete.  However, I am getting a
Run-Time error '3265' Item not found in this collection.

When I coded this using local tables it worked perfectly.  not sure what I'm doing wrong.

dhookom (Programmer)
16 Feb 12 12:30
Check out FAQ705-7148: How to debug your code. Always Dim strSQL so you can find your issues. Also, learn how to use TGML since you seem to be posting a few questions here.

Tell us which line of code is causing the error. You may need something regarding dbSeeChanges.


Dim strSQL As String
If Not (Me.sfCategory.Form.Recordset.EOF And _
       Me.sfCategory.Form.Recordset.BOF) Then
    If MsgBox("Are you sure you want to Delete?", vbYesNo) = vbYes Then
        strSQL = "Delete from dbo_COMPLIANCE_CATEG " & _
          "where ID=" & Me.sfCategory.Form.Recordset.Fields("ID")
        debug.print strSQL
        CurrentDb.Execute strSQL, dbFailOnError
    End If
End If

Hook'D on Access
MS Access MVP

MajP (TechnicalUser)
16 Feb 12 12:33
my guess is that the ID field is no longer simply ID. Find out the real name

dim fld as dao.field
for each fld in Me.sfCategory.Form.Recordset.Fields
  if = "ID" then
     msgbox "ID found
  end if
next fld
daveinchicago (IS/IT--Management) (OP)
16 Feb 12 12:36
adding dbseechanges corrected the problem


What is TGML?
dhookom (Programmer)
16 Feb 12 12:51
TGML is the markup that allows you to post formatted content in this site such as my reply with the Code section. This makes postings much easier to read. You can format colors, fonts, backgrounds, and more.

Always use the [Preview Post] button. There is additional help information available in the preview.

Hook'D on Access
MS Access MVP

TheAceMan1 (Programmer)
19 Feb 12 15:33
How are ya daveinchicago . . .



'is the same as:
'as well as:

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

daveinchicago (IS/IT--Management) (OP)
21 Feb 12 15:37
ok, now I have a similar problem with the code below.

If Not (Me.sfRULENOTE.Form.Recordset.EOF And Me.sfRULENOTE.Form.Recordset.BOF) Then
If MsgBox("Are you sure you want to Delete?", vbYesNo) = vbYes Then
CurrentDb.Execute "Delete from dbo_COMPLIANCE_ACCT_NOTE where ID=" & Me.sfRULENOTE.Form.Recordset.ID, dbSeeChanges
End If
End If

I'm getting an error saying that I need to use dbSeeChanges.  But I am.


Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close