CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Posts
    264

    Deleting from an ADO recordset

    I have developed a form where the user can pick a name out of a combolist and delete that name from the list. I know how to delete the record but how do I update the rest of the fields on that form after the record is deleted? Currently, it just updates the list and not the rest of the textboxes on the form. My current Delete code looks like this:


    private Sub mnuDel_Click()
    Dim Response
    Response = MsgBox("Are you sure you want to delete " & cboList1.Text & "?", vbQuestion + vbYesNo, "Delete driver")
    If Response = vbYes then
    With datPrimaryRS.Recordset
    .Delete
    .Update
    .MoveNext
    If .EOF then .MoveLast
    End With
    Exit Sub
    End If
    End Sub




    I only have one text field on this form named 'txtCarNo' that I want to update after I perform the delete.

    Another simple one right?
    Thanks guys!




  2. #2

    Re: Deleting from an ADO recordset

    It's been a little while since I've used the data control (problems like the one you are describing are why I stopped). But I remember having a similar problem and solving it. I believe that I would store the absoluteposition of the recordset before deleting and then move to it after deleting. You may also have to call the refresh method of the data control.

    Charlie Zimmerman
    http://www.freevbcode.com


  3. #3
    Join Date
    Jan 2000
    Posts
    9

    Re: Deleting from an ADO recordset

    Try recordset.resynch


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

Featured