Working with ADO Recordsets.

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Good morning,

I'm posting this in the wrong forum (which is the
right??), but I'm sure I can get the answer here. Thank
you in advance.

I'm lookin at this Recordset object in ADO 2.7 and I would
like to manipulate the data in the recordset before I use
the range object's "CopyFromRecordset" method. I don't
want my modifications to affect the database however, I
just want to make changes to values based upon other
fields within the recordset for reporting purposes.

The following code gives me an application or object
defined error (Runtime Error '3705'):

rsResults.CursorType = adOpenStatic
rsResults.Filter = "UserID='0000'"
Do Until rsResults.EOF
' Line below is the culprit.
rsResults.Fields("UserID").Value = rsResults.Fields
("XferID").Value
rsResults.MoveNext
Loop
rsResults.Filter = adFilterNone
rsResults.Fields.Delete ("XferID")
qry.ADOOutputResults rsResults, rngTarget
rsResults.Close
Set rsResults = Nothing

Is this something I can do? Or do I have to put the
recordset in a range before I can manipulate the values?
I'd like to remove the Field XferID after I take it's
value.

Thanks for the help.

-Brad
 
Brad,

Probably the best way to do this is to transfer the recordset to an array
like this:
rsResults.GetRows
and then do the data manipulations in the array.
This will be faster than manipulating the recordset.

RBS
 
Back
Top