Link to home
Start Free TrialLog in
Avatar of Stoop
Stoop

asked on

Can you set a recordset value temporarily?

I'm using vb6 and connecting thru ADO.
I want to know if its possible to select
an item from the db, then go thru each item
in the recordset and if any equal 0 then change it to 1
temporarily.

Basically I have a quantity field and if
that value is zero I want to change it to
1 only temporarily.

I'll be using the code in a Crystal Viewer form
and I do not want to update the db.
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AnswerTheMan
AnswerTheMan

use another field for temporary insertion.
take care to clear its values when you don't need it anymore - until the next time.
Of course the answer posted will update your db permanently.

In DAO I would create a workspace and use a begintrans method at the start of my procedure, and a rollback method at the end. This will cancel any change made to the database during your procedure. I'm not sure if the workspace object is part of ADO, however. If you can't rollback in ADO, I like AnswerTheMan's suggestion.
Sorry, when I pasted the answer I gave, I forgot the CRITICAL line...

Set duplicate = original.Clone

Cheers!
Disregard the clone, It doesn't keep a separate copy of the recordset in vb5, You need to set a local variable copy, then edit/update and then restore the local copy.


Cheers!
Avatar of Stoop

ASKER

A little more info on my question.....I'm also using seagate's crystal reports and the table that it queries holds the quantity value and the only time I want the zeros to change to ones is when you print or preview the report