Addnew empty row - how to cancel 
Author Message
 Addnew empty row - how to cancel

 When a user starts to add a new record,(which results in an AddNew for
the adodc recordset) and then changes their mind and wants to just go
back to another record, they cannot leave the new empty record. They get
a message "Cannot insert an empty row - must have at least one column
value set" and they are stuck on that record. The only thing they can do
to get off that new empty record is Close the form or Press the
"Refresh" button for the ado. I'm looking for a way to
make this more user friendly.

Firstly, is there an easy way for me to tell in advance if the record is
empty, or if the user has not entered values into any controls?
I thought that if I could detect the situation ahead of time, then I
could avoid the attempt to update the recordset.
The other angle I thought of was to try to trap the error before it goes
out to the screen and then do a "Refresh" under the covers, but I seem
not to be able to do this.

Any insights, comments or suggestions would be much appreciated. Thanks
in advance.
Christine

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 06 May 2002 03:00:00 GMT  
 Addnew empty row - how to cancel

        Hello,

    When you are moving in the recordset, ADO automaticaly fired an update
if a Addnew or Edit was going on. So that's why you get this error. To
cancel it, you just have to call :
rs.CancelUpdate, which will cancel the pending changes and then you can move
again trough your recordset !
    Before making a rs.movenext, just check if the field are empty ! I never
used a datacontrol (I have still vb5) but I guess there should be this
method or maybe it's an event ! Try to look there to find the equivalent !

        Bless

--

Jean-Christophe BERTHON

tel   : (+354) 562 6611 +406

Nttrufr?eistofnun slands
(Icelandic Institute of Natural History)

Home information :
Address : Starhagi 2 (kjallari), 107 REYKJAVK
tel     : (+354) 561-7382

web     : http://jcberthon.ifrance.com/


Quote:
> When a user starts to add a new record,(which results in an AddNew for
> the adodc recordset) and then changes their mind and wants to just go
> back to another record, they cannot leave the new empty record. They get
> a message "Cannot insert an empty row - must have at least one column
> value set" and they are stuck on that record. The only thing they can do
> to get off that new empty record is Close the form or Press the
> "Refresh" button for the ado. I'm looking for a way to
> make this more user friendly.

> Firstly, is there an easy way for me to tell in advance if the record is
> empty, or if the user has not entered values into any controls?
> I thought that if I could detect the situation ahead of time, then I
> could avoid the attempt to update the recordset.
> The other angle I thought of was to try to trap the error before it goes
> out to the screen and then do a "Refresh" under the covers, but I seem
> not to be able to do this.

> Any insights, comments or suggestions would be much appreciated. Thanks
> in advance.
> Christine

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 07 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Err: Empty row cannot be inserted. during AddNew

2. DBCOMBO cancels AddNew method

3. Cancel from AddNew?

4. How do you cancel an AddNew?

5. Cancel an ADDNEW event?

6. how to cancel Recordset.addnew method

7. How to Cancel AddNew in DataGrid?

8. .recordset.addnew = canceled by associated object

9. Canceling an .AddNew

10. How do you programatically cancel and .Addnew?

11. How to differentiate empty inputbox and cancel?

12. addnew does not work with empty tables.

 

 
Powered by phpBB® Forum Software