Do you want to save the changes? yes No and CANCEL 
Author Message
 Do you want to save the changes? yes No and CANCEL

LS

I have the following problem with MS Access. I have added the code in the
BeforeUpdate event: "Do you want to save the changes? " With the buttons yes
no and cancel.
The cancel button does not behave the way i like. When I press Cancel, I
would like to stop all other events are processes and return to the form
without changing anything. So temporary changes stay on the form.

For example:
I press the close button. The message "Do you want .. " appears from the
BeforeUpdate event, pressing cancel does not make the close command stop. So
the form is closed anyway. I would like the form to return to the form
without doing anything.

Please Help Me,

Frank



Thu, 03 May 2001 03:00:00 GMT  
 Do you want to save the changes? yes No and CANCEL
You need to check the value returned by the message box. This can be done
with a case statement.
if the answer is vbYes, do nothing
If vbNo do something
If VbCancel then use undo the form with UnDo
--
Free Microsoft Access Zip code and area code files at
http://home.inreach.com/mpainter/

-

Quote:
>LS

>I have the following problem with MS Access. I have added the code in the
>BeforeUpdate event: "Do you want to save the changes? " With the buttons
yes
>no and cancel.
>The cancel button does not behave the way i like. When I press Cancel, I
>would like to stop all other events are processes and return to the form
>without changing anything. So temporary changes stay on the form.

>For example:
>I press the close button. The message "Do you want .. " appears from the
>BeforeUpdate event, pressing cancel does not make the close command stop.
So
>the form is closed anyway. I would like the form to return to the form
>without doing anything.

>Please Help Me,

>Frank



Thu, 03 May 2001 03:00:00 GMT  
 Do you want to save the changes? yes No and CANCEL
On Sun, 15 Nov 1998 15:14:25 +0100, "Frank van der Linden"

What I did when I had a similar problem was have the "EXIT SUB" line
before the END IF line in the section of coding you are using to check
for the CANCEL button press.  If the CANCEL button is pressed, then
EXIT SUB should stop the form from closing.

Quote:
>LS

>I have the following problem with MS Access. I have added the code in the
>BeforeUpdate event: "Do you want to save the changes? " With the buttons yes
>no and cancel.
>The cancel button does not behave the way i like. When I press Cancel, I
>would like to stop all other events are processes and return to the form
>without changing anything. So temporary changes stay on the form.

>For example:
>I press the close button. The message "Do you want .. " appears from the
>BeforeUpdate event, pressing cancel does not make the close command stop. So
>the form is closed anyway. I would like the form to return to the form
>without doing anything.

>Please Help Me,

>Frank



Thu, 03 May 2001 03:00:00 GMT  
 Do you want to save the changes? yes No and CANCEL
I think you want just a Yes/No, not a Yes/No/Cancel.  As in:
If MsgBox("Are you really, positively, un{*filter*}uratedly sure?",vbYesNo,"Confirm")
= vbNo Then
    Cancel = True
End If

Change vbYesNo to vbYesNo + vbDefaultButton2 if you want NO as the default.


Quote:
> LS

> I have the following problem with MS Access. I have added the code in the
> BeforeUpdate event: "Do you want to save the changes? " With the buttons yes
> no and cancel.
> The cancel button does not behave the way i like. When I press Cancel, I
> would like to stop all other events are processes and return to the form
> without changing anything. So temporary changes stay on the form.

> For example:
> I press the close button. The message "Do you want .. " appears from the
> BeforeUpdate event, pressing cancel does not make the close command stop. So
> the form is closed anyway. I would like the form to return to the form
> without doing anything.

> Please Help Me,

> Frank



Thu, 03 May 2001 03:00:00 GMT  
 Do you want to save the changes? yes No and CANCEL
You may want to also post your code, it will help people understand better
where the error is.  Can't really help if we don't know "how" you're trying
to do something.

Bob


Quote:
>LS

>I have the following problem with MS Access. I have added the code in the
>BeforeUpdate event: "Do you want to save the changes? " With the buttons
yes
>no and cancel.
>The cancel button does not behave the way i like. When I press Cancel, I
>would like to stop all other events are processes and return to the form
>without changing anything. So temporary changes stay on the form.

>For example:
>I press the close button. The message "Do you want .. " appears from the
>BeforeUpdate event, pressing cancel does not make the close command stop.
So
>the form is closed anyway. I would like the form to return to the form
>without doing anything.

>Please Help Me,

>Frank



Thu, 03 May 2001 03:00:00 GMT  
 Do you want to save the changes? yes No and CANCEL

Quote:
> LS

> I have the following problem with MS Access. I have added the code in the
> BeforeUpdate event: "Do you want to save the changes? " With the buttons yes
> no and cancel.
> The cancel button does not behave the way i like. When I press Cancel, I
> would like to stop all other events are processes and return to the form
> without changing anything. So temporary changes stay on the form.

> For example:
> I press the close button. The message "Do you want .. " appears from the
> BeforeUpdate event, pressing cancel does not make the close command stop. So
> the form is closed anyway. I would like the form to return to the form
> without doing anything.

> Please Help Me,

> Frank

  Hi Frank,

on the last project I had to solve a similarly problem:

On before Update, the had to be some cross checking and depending on the result

the update had to be canceled or continued.

When the before Update starts, the db-Engine allready introduced the process of

updating the database.
This process must be stopped. And that cannot be done by simply exit out of the
sub.
in addition you have to tell the engine to cancel the update process.

this will be done by the command:

DoCmd.CancelEvent

insert this commend to the point where you want to break out of the process and

your problem should be solved !

Good luck

Michael



Fri, 04 May 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. save changes box is not wanted

2. ADO WillChangeField event: can't cancel change by changing adStatus

3. "Yes / Yes to All/ No / Cancel" MsgBox?

4. Need a "Save data?" Yes/No/Cancel Prompt When Closing Form

5. Changing to landscape w/o EndDoc (yes I read the FAQ)

6. change yes/no boolean field to another language in datagrid

7. Gracefully cancel a save

8. Save changes back to a previously saved .msg file

9. using VBA I need to determine is the user canceled or saved my form

10. cancel save of custom form

11. using VBA I need to determine is the user canceled or saved my form

 

 
Powered by phpBB® Forum Software