operation not allowed when object is closed vb6?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vasavivenu
    New Member
    • Feb 2011
    • 37

    operation not allowed when object is closed vb6?

    Hi,


    My code is
    Code:
    ElseIf pref = "Delete" Then
    If r.STATE = 1 Then r.Close
       r.Open "delete from visitors  where ID=" & Val(fg.TextMatrix(fg.row, 0)), dbcon, adOpenKeyset, adLockOptimistic
       If MsgBox("Are You Sure To Delete The Record", vbYesNo) = vbYes Then r.Delete
        r.Update 'DriverDetails
    End If
    how can i over come this error

    Thanks in Advance,
    vasavivenu.
  • Eric d
    New Member
    • Aug 2011
    • 2

    #2
    without looking at it in detail, it looks to me that you are deleting first, then asking the question about do you want to delete? and then you are trying to do update on recordset that has just been deleted ....
    have you tried answering no to your question and see if record is NOT deleted?
    remove the rs.update and see if error goes away

    Comment

    • vasavivenu
      New Member
      • Feb 2011
      • 37

      #3
      Thank you,

      I will try it.

      Comment

      Working...