Results 1 to 3 of 3

Thread: Ado data control (Resolved)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    81

    Thumbs up Ado data control (Resolved)

    hi,

    The attached sample is use ADO data control to maintain data. But my delete method of the ADO data control can not work. I have the error: Multiple-steps operations generated errors. Check each status value. Please help !
    Attached Files Attached Files
    Last edited by vivian2u; Apr 26th, 2005 at 11:47 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Ado data control

    This required a little research. It seems that when using the ADO Data Control, you have to Bookmark the record before it can be deleted. Make the following change to your code, and you should be just fine.
    VB Code:
    1. Private Sub cmdDelete_Click()
    2. Dim str As Byte
    3.  
    4. str = MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo)
    5. If str = vbYes Then
    6.  
    7.   With Adodc1.Recordset
    8.     .Bookmark = .Bookmark '<==== ADD THIS LINE TO YOUR ROUTINE
    9.     .Delete
    10.    
    11.       'change current record
    12.       If .RecordCount > 0 Then
    13.          If .BOF Then
    14.             .MoveFirst
    15.          Else
    16.             .MovePrevious
    17.          End If
    18.       Else
    19.         ''Record count = 0
    20.          UpdateButtons
    21.       End If
    22.      
    23.    End With
    24. End If
    25. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    81

    Re: Ado data control

    You are right. I add the Bookmark to the record before deleted it and it work.
    Thank you very much for your help.

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