I have been working at this all day, but here is the idea. I have a stored procedure which returns a recordset of employee information to the client. The recordset returned includes EmpID, EmpName, and EmpAsgn (assigned).
I want to do the following:
1) Connect to SQL Server and retrieve the recordset
2) Disconnect the recordset
2) Populate a listbox of employees unassigned
3) Populate a listbox of employees assigned
These all work fine. The next part is what breaks. I want to allow a user to mark an employee as assigned in the local recordset, but since SQL Server doesn't have a boolean value, I return as a SmallInt, which corresponds to the Access Integer type. When I try to update the local recordset though by changing the value from 0 to 1, I get an error
Run-time Error '-2147217887 (80040e21)':
Multiple-step operation generated errors. Check each status value.
Research has proven inadequate, but I have gathered that the ADO Error is telling me that my data types are incompatible. I have tried so many different types in SQL Server and within Access, but absolutely cannot get past this error.
In case you are wondering why I update a disconnected recordset instead of connecting it, the assignments are stored into a separate table with one-to-many relationships. This is a client-side part of my project.
Static Value Example:
Code:
CREATE PROCEDURE dbo.upProjTrack_RetRSEmps AS
SET NOCOUNT ON
SELECT EmpID,
EmpLogin,
CAST(0 AS SMALLINT) AS EmpAsgn
FROM tblEmployees
WHERE Inactive = 0
GO
I want to do the following:
1) Connect to SQL Server and retrieve the recordset
2) Disconnect the recordset
2) Populate a listbox of employees unassigned
3) Populate a listbox of employees assigned
These all work fine. The next part is what breaks. I want to allow a user to mark an employee as assigned in the local recordset, but since SQL Server doesn't have a boolean value, I return as a SmallInt, which corresponds to the Access Integer type. When I try to update the local recordset though by changing the value from 0 to 1, I get an error
Run-time Error '-2147217887 (80040e21)':
Multiple-step operation generated errors. Check each status value.
Research has proven inadequate, but I have gathered that the ADO Error is telling me that my data types are incompatible. I have tried so many different types in SQL Server and within Access, but absolutely cannot get past this error.
In case you are wondering why I update a disconnected recordset instead of connecting it, the assignments are stored into a separate table with one-to-many relationships. This is a client-side part of my project.
Static Value Example:
Code:
Dim ProjAssignments as ADODB.Recordset
Dim cnn As ADODB.Connection
Set ProjAssignments = New ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open GlobalVars.gcStrPath
With ProjAssignments
Set .ActiveConnection = cnn
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.CursorLocation = adUseClient 'adUseClient creates a disconnectable recordset
.Open "upProjTrack_RetRSEmps", Options:=adCmdStoredProc
Set .ActiveConnection = Nothing 'Disconnect the recordset
End With
If Not cnn Is Nothing Then
If cnn.State <> adStateClosed Then
cnn.Close
End If
Set cnn = Nothing
End If
With ProjAssignments
.MoveFirst
.Find "EmpID = 999999"
If Not .EOF Then 'Found the employee
!IsAsgn = 1 [COLOR=red]'<<BREAKS HERE[/color]
.Update
End If
End With