PDA

Click to See Complete Forum and Search --> : ADO: Addnew on a DEC recordset


pardede
Apr 7th, 2000, 04:12 AM
I am using bound controls, bound to a DE-command opening one single table to enter a new record. On form load I invoke the addnew method of the recordset. Using a command button I execute the update method. If data are correct there's no problem.

However, if we have incorrect data (i.e. wrong datatype), we will get an error message, which is logical. Problem is, after this error (which i trap), I cannot execute CancelUpdate - I get runtime error: "operation cancelled during notification, no columns changed". Then I omit the CancelUpdate and I can close the form. But the next time i open the form, I get an error message stating that i cannot add/edit record due to some error.

When i look carefully this is because the current record of the recordset is still the one i was trying to add before (thus the erraneous one). Somehow ADO keeps the pointer there (quite logical since no CancelUpdate was invoked/invokable).

My question is: is there a way to remove this 'pseudo-existing' record before I close the window. I tried closing the recordset, closing the connection. Nothing works. My workaround for now is give correct dummy values to the fields, save this new record, and directly delete it afterwards..... But I don't think that's the way it meant to be....

Comments are much appreciated

pardede
Apr 9th, 2000, 02:18 PM
Anyone at all?

Maybe I didn't ask the question clear enough. My problem is that a newly added record is the current record in the DE recordset, and if it contains erraneous data when updating, there's no way to remove it from the recordpointer (not by cancelupdate, not by move, not by delete...) So what I'm asking is, does anyone know how to or has any workaround