Click to See Complete Forum and Search --> : Deleting from an ADO recordset


gknierim
February 4th, 2000, 12:42 PM
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!

czimmerman
February 4th, 2000, 01:37 PM
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

nsundara
February 4th, 2000, 04:59 PM
Try recordset.resynch