EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form) 
Author Message
 EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form)

Hi people,

I have the following situation. I want to prompt the user to save his
changes (to a record) when he closes the form (using cntrl+f4 or the close X
button). In the QueryUnload event of the form, I check the EditMode property
of the recordset (adodc) and if the Editmode property is adEditInProgress or
adEditAdd, I promt the user if he wants to save changes (Yes, No, Cancel)
If the user modifies only ONE field and does NOT set the focus on another
field before closing the form using cntrl+F4 or the Close button (X), the
EditMode property of the recordset is still adEditNone. Setting the focus to
anothor control programatically in the QueryUnload event doesn't help.

Am I using the wrong approach or is there just something I'm missing?

Thanks for your help.

Sven De Bont



Sun, 09 May 2004 17:14:35 GMT  
 EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form)
Yep, you are mising the ValidateControls method of the form.
This method causes any unvalidated controls to validate, and is for
exactly this purpose!



Quote:
>Hi people,

>I have the following situation. I want to prompt the user to save his
>changes (to a record) when he closes the form (using cntrl+f4 or the close X
>button). In the QueryUnload event of the form, I check the EditMode property
>of the recordset (adodc) and if the Editmode property is adEditInProgress or
>adEditAdd, I promt the user if he wants to save changes (Yes, No, Cancel)
>If the user modifies only ONE field and does NOT set the focus on another
>field before closing the form using cntrl+F4 or the Close button (X), the
>EditMode property of the recordset is still adEditNone. Setting the focus to
>anothor control programatically in the QueryUnload event doesn't help.

>Am I using the wrong approach or is there just something I'm missing?

>Thanks for your help.

>Sven De Bont

--
Chris Petchey


Sun, 09 May 2004 20:35:20 GMT  
 EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form)
thank you very much! I knew it must have been something simple...


Quote:
> Yep, you are mising the ValidateControls method of the form.
> This method causes any unvalidated controls to validate, and is for
> exactly this purpose!



> >Hi people,

> >I have the following situation. I want to prompt the user to save his
> >changes (to a record) when he closes the form (using cntrl+f4 or the
close X
> >button). In the QueryUnload event of the form, I check the EditMode
property
> >of the recordset (adodc) and if the Editmode property is adEditInProgress
or
> >adEditAdd, I promt the user if he wants to save changes (Yes, No, Cancel)
> >If the user modifies only ONE field and does NOT set the focus on another
> >field before closing the form using cntrl+F4 or the Close button (X), the
> >EditMode property of the recordset is still adEditNone. Setting the focus
to
> >anothor control programatically in the QueryUnload event doesn't help.

> >Am I using the wrong approach or is there just something I'm missing?

> >Thanks for your help.

> >Sven De Bont

> --
> Chris Petchey



Mon, 10 May 2004 00:26:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form)

2. EditMode Property of ADO Recrodset Incorrect if Validate Event doesn't run (close form)

3. Validate event doesn't fire into OCX

4. SSTab doesn't fire Validate Event

5. Form's validate does not fire usercontrol(inside textbox) validating event

6. Editmode doesn't change

7. VB Run time error 438 : Object doesn't support this property or method

8. Load event doesn't run after upgrade

9. Procedure doesn't run correctly usin ADO

10. Validating in a datagrid in EditMode

11. Overridden property doesn't appear in Properties window

12. Validate Code - Why doesn't this work!?

 

 
Powered by phpBB® Forum Software