Help! Getting an error copying the data from one column to the same column in a similar recordset..

Posted by Mike D on Stack Overflow See other posts from Stack Overflow or by Mike D
Published on 2011-01-06T22:16:14Z Indexed on 2011/01/07 8:54 UTC
Read the original article Hit count: 210

Filed under:
|
|
|
|

I have a routine which reads one recordset, and adds/updates rows in a similar recordset. The routine starts off by copying the columns to a new recordset:

Here's the code for creating the new recordset..

For X = 1 To aRS.Fields.Count
    mRS.Fields.Append aRS.Fields(X - 1).Name, aRS.Fields(X - 1).Type, aRS.Fields(X - _
          1).DefinedSize, aRS.Fields(X - 1).Attributes
Next X

Pretty straight forward. Notice the copying of the name, Type, DefinedSize & Attributes...

Further down in the code, (and there's nothing that modifies any of the columns between.. ) I'm copying the values of a row to a row in the new recordset as such:

 For C = 1 To aRS.Fields.Count
     mRS.Fields(C - 1) = aRS.Fields(C - 1)
 Next C

When it gets to the last column which is a numeric, it craps with the "Mutliple-Step Operation Generated an error" message.

I know that MS says this is an error generated by the provider, which in this case is ADO 2.8. There is no open connect to the DB at this point in time either.

I'm pulling what little hair I have left over this one... (and I don't really care at this point that the column index is 'X' in one loop & 'C' in the other... I'll change it later when I get the real problem fixed...)

© Stack Overflow or respective owner

Related posts about error

Related posts about vb6