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.
StoopAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mcriderConnect With a Mentor Commented:
Here you go!

recordset.edit
!item=1
recordset.update


Cheers!
0
 
AnswerTheManCommented:
use another field for temporary insertion.
take care to clear its values when you don't need it anymore - until the next time.
0
 
vettrangerCommented:
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.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mcriderCommented:
Sorry, when I pasted the answer I gave, I forgot the CRITICAL line...

Set duplicate = original.Clone

Cheers!
0
 
mcriderCommented:
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!
0
 
StoopAuthor Commented:
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
0
All Courses

From novice to tech pro — start learning today.