Results 1 to 24 of 24

Thread: Having trouble with the delete code!

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    449

    Re: Having trouble with the delete code!

    I think I have got it Hack,

    I didnt think about opening the recordset again. I thought I could just call it with the "Fillfields" sub.

    I opened a new rs and now it appears to be working.

    Yep, its working great now!! Thanks Hack. This is what I have done:
    vb Code:
    1. Private Sub cmdDelete_Click()
    2.     If MsgBox("Deleting this record will completely remove it from the database!" & _
    3.     vbCrLf & "Are you sure you wish to delete this record?", vbQuestion + vbYesNo, "Delete Record") = vbNo Then
    4.         Exit Sub
    5.     Else
    6.         If Not (rs.BOF = True Or rs.EOF = True) Then
    7.             rs.Delete
    8.         End If
    9.     End If
    10.     Set rs = New ADODB.Recordset
    11.     rs.CursorLocation = adUseClient
    12.     strSQL = "Select * From MT Order By ID ASC"
    13.    
    14.     rs.Open strSQL, strConnection, adOpenDynamic, adLockOptimistic
    15.    
    16.     ClearBoxes
    17.     If Not (rs.BOF = True Or rs.EOF = True) Then
    18.         rs.MoveNext <----I'm not sure, but I think I dont need this since my sql takes care of the order
    19.         Fillfields
    20.     End If
    21. End Sub
    Last edited by cfd33; Apr 12th, 2007 at 02:18 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width