Link to home
Start Free TrialLog in
Avatar of Sketchy
Sketchy

asked on

Modifying recordsets w/out updating DB

I am using Access and ADO for my Database.  

My program generates a recordset to get a list of items for a particular user (SQL query searches for username).  

The items are placed into a listbox, and the user can select them, which displays a variety of properties about the chosen item.  I want the user to be able to modify the properties, so if they edit the values in the textbox, this should modify the values in the recordset (so if they select a different item, then go back to a modified one, they will see the changes, because each time they click an item it queries the Recordset for the desired item)  Then, later on, when they click a "save" button, the program will call Update.

When the user changes a textboxes text, the textbox_change( ) method is called.  So in this method, I search through the recordset, find the item whose property was modified, and have code like:

recordset!property = txtboxText

THE problem is this:
When I change the recordset in the change( ) sub, as soon as I leave the subroutine, update is automatically called, but I only want the recordset to be modified (until the "save" button is pressed).  If I call CancelUpdate right before the end of the Sub, the changes are not made to the database, but at the same time, the changes to the recordset are also eliminated.

I thought it might have something to do with how I open the recordset, I use the form:
recordset.open SQLquery, DBConnection, adOpenForwardOnly(I have tried OpenDynamic, OpenStatic), adLockOptimistic (I have tried Pessimistic, Read Only wont let me modify recordset), adCmdText

Any help would be Greatly appreciated...
ASKER CERTIFIED SOLUTION
Avatar of wsh2
wsh2

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 Sketchy
Sketchy

ASKER

Thanks, that solved the problem!!