[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:
Dim rsDel As Recordset
Dim cnn As Connection
Dim strSQL As String
Set rsDel = New Recordset
Set cnn = CurrentProject.Connection
strSQL = "Select * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID & " "
rsDel.Open strSQL, cnn, adOpenDynamic, adLockOptimistic, adCmdText
While Not rsDel.BOF And Not rsDel.EOF
With rsDel
.Delete
.Update
End With
Wend
rsDel.Close
Does anyone know a workround?
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:
cnn.Execute("Delete * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID)
Re: Multi Step OLE DB Generated errors
excellent thanks
VB Code:
Dim cnn As Connection
Dim strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "Delete * from EmployeeStates Where FK_EmpID =" & Me.Parent!EmployeeID & " "
cnn.Execute strSQL