Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO addnew cancelupdate problem 1

Status
Not open for further replies.

knulisch

Programmer
Oct 10, 2000
18
US
I am having a problem with cancelling an update on my form. My form consists of two tabs - a list tab and an edit tab. The data for each tab is driven by the same recordset - the difference being that the list tab is just a datagrid of all records in the recordset and the edit tab shows them one by one. Records cannot be maintained from the list tab - only scrolled through.

When I add a record from the edit tab (using addnew) and then cancel it in progress (using cancelupdate) the record will still be saved in my database. It appears that the cancelupdate is working because the values for the recordset in debug go back to those of the previous record.

Any help would be appreciated - and I would be happy to supply more info.

Thanks.
 
could you post the relevant portion of code with you are facing this problem. i guess it could be because of some recordset update event.
 
You are not alone.
I'm stopped by this trouble too.
I'm working VB6 SP5 & Access2000 fully upgraded. I add a new record, modify a field, and do a cancelupdate. The record is not removed, but the cursor goes back to before recordset I had been.
I know (MSN) if you cancelupdate before modifying recordset, you get an error, ok, that is not the case.

 
You're using bound controls (i.e. the DataGrid). This means that any time the control's contents change and the user moves to another control (or even another cell), the underlying database (not just the recordset) is updated. If you want the flexibility of letting the user cancel an update or new record, you'll have to gather all user-entered information separately, maybe on a different form. Once the data is collected, AddNew, assign new values to the fields, and Update all in one button click. That gives you the option of a Cancel button that can be clicked before the new/existing record is ever added/updated.

Hope that helps!

-Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top