Unusual Error - TechRepublic
General discussion
November 27, 2001 at 07:05 AM
afisher

Unusual Error

by afisher . Updated 24 years, 7 months ago

I have a property table and a details table. The PK for the property table is an autonumber. When I save a new record, I create the property table record first, then I save the detail record using a different recordset, assigning the PK in the details table recordset (SaveRSDetails) by referencing the PK in the first recordset (SaveRS). I can assign the PK value without problems. When I try to assign any other values to the new record in SaveRSDetails, I get the following message:
————————————————————————————
Run-time error ?-2147217887 (80040e21)?:

Multiple-step operation generated errors. Check each status value.
————————————————————————————-

The values are passed to my class module through properties and stored in the vntCompRecord array. Here is the code (with extraneous code removed for the sake of simplicity):

Public Function Save() As Boolean

Dim i As Integer
Dim j As Integer
Dim SaveRS As ADODB.Recordset
Dim SaveRSDetails As ADODB.Recordset

strSQL = “Actual Statement Omitted?
strSQLDetails = ” Actual Statement Omitted ”

Set SaveRS = New ADODB.Recordset
Set SaveRS = GetRecordSet(strSQL, True)
SaveRS.AddNew

For i = 1 To 13
SaveRS(i) = vntCompRecord(i)
Next i

SaveRS.Update

Set SaveRSDetails = New ADODB.Recordset
Set SaveRSDetails = GetRecordSet(strSQLDetails, True)
SaveRSDetails.AddNew
SaveRSDetails(0)= SaveRS(0)

j = 1

For i = 14 To 37
SaveRSDetails(j) = vntCompRecord(i)
j = j + 1
Next i

SaveRSDetails.Update
Save = True

End Function

This discussion is locked

All Comments