Results 1 to 3 of 3

Thread: [RESOLVED] Multi Step OLE DB Generated errors

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Resolved [RESOLVED] Multi Step OLE DB Generated errors

    Hi People
    I am getting the error Multi Step OLE DB Generated error on this piece of code.
    VB Code:
    1. Dim rsDel As Recordset
    2. Dim cnn As Connection
    3. Dim strSQL As String
    4. Set rsDel = New Recordset
    5. Set cnn = CurrentProject.Connection
    6. strSQL = "Select * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID & " "
    7. rsDel.Open strSQL, cnn, adOpenDynamic, adLockOptimistic, adCmdText
    8.  
    9.    While Not rsDel.BOF And Not rsDel.EOF
    10.   With rsDel
    11.   .Delete
    12.        .Update
    13.        
    14.    
    15.     End With
    16.        Wend
    17.    rsDel.Close
    Does anyone know a workround?

  2. #2
    Hyperactive Member
    Join Date
    May 2005
    Posts
    324

    Re: Multi Step OLE DB Generated errors

    It looks like you are deleting all records with a specific employee ID- presumably an employee who leaves. (BTW why not instead have a boolean field to mark that they have left. That way you retain the data)
    Assuming cnn is an ADODB connection, try:
    VB Code:
    1. cnn.Execute("Delete * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID)

  3. #3

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Multi Step OLE DB Generated errors

    excellent thanks
    VB Code:
    1. Dim cnn As Connection
    2. Dim strSQL As String
    3. Set cnn = CurrentProject.Connection
    4. strSQL = "Delete * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID & " "
    5.  cnn.Execute strSQL

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