Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error -2147217887 when updating subform recordset

Status
Not open for further replies.

DatabaseDude

Programmer
Nov 7, 2005
112
US
There is a main form, frmForm, whose unbound fields are populated by retrieving data from SQL, using a class object. There is no recordset on the main form.

A subform, fsubSubform, is bound to a disconnected ADO recordset. The recordset populated by retrieving the main form's associated records from SQL.

Field names and data types for fsubSubform:
ContactType nvarchar(15)
ContactInfo nvarchar(255)
Modified int

Sample data:
ContactType = 'Test'
ContactInfo = 'Eddie Guerrero'
Modified = 0

A second subform, fsubSubform_Edit, exists only for editing these records. It is not bound to any recordset. A command button, cmdEdit, transfers the field values from the edited record to fsubSubform_Edit.

Code:
    Set frm = Forms("frmForm")
    
    With frm.fsubSubform_Edit
        ' Transfer values from this record to Add/Edit subform
        For Each fld In Me.Recordset.Fields
            .Form(fld.Name).Value = fld.Value
        Next
    End With

The data for fsubSubform is successfully passed to the fields on fsubSubform_Edit, with no error.

Data is then changed on fsubSubform_Edit.

Sample data:
ContactType = 'Test'
ContactInfo = 'Chavo Guerrero'
Modified = 0
(Modified is set to 1 by the After_Update event on ContactInfo)

After changes are made on fsubSubform_Edit, a Save command button passes the data back to the recordset behind fsubSubform.

Code:
    With Forms!frmForm!fsubSubform.Form.Recordset
        For Each fld In .Fields
           ' Subform field names match
           fld.Value = Me(fld.Name)
        End If
                
        Next fld
        
        Set fld = Nothing
        .Update
     End With

This code produces error -2147217887, with the message "Multiple-step operation generated errors. Check each status value."

Typically this error means that there is a data typing error, from what I have read.

By stepping through the code, I find that the field that "bombs" the process is Modified. However, it appears that it's in its original integer numeric format.

Any ideas?

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top