Connecting Tech Pros Worldwide Help | Site Map

Forms and cancelling updates

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:15 PM
Samuel Hon
Guest
 
Posts: n/a
Default Forms and cancelling updates

Hi All

I'm trying to add an Save/Cancel feature to my forms so that users can
make changes and then reverse them if they so decide.

I've disabled the close button and blocked the Alt-F4 combination so
that the only way to exit the form is to the use the Save/Cancel
buttons

The Save button is straight-forward using DoCmd.Close....

However, the Cancel button is proving to be a bit of a pig. I'm using
ideas from
http://support.microsoft.com/?kbid=197103
but it doesnt mention a Cancel so I'm using

MsgBox("Do you want to save?", vbInformation + vbYesNoCancel, "Save
Record")

The Yes/No is easy to do, but the vbCancel response is not. As one of
the guys says in
http://www.experts-exchange.com/Data..._20810844.html

"if you close the form and hit Cancel and the record is in reality
saved. " ... "in the meantime you will get the message box but if you
hit no you will be stuck with the record that was saved when you hit
cancel."

Does anyone have any ideas on how to implement a decent cancel
rountine?

Thanks in advance

Sam

  #2  
Old November 12th, 2005, 06:15 PM
MGFoster
Guest
 
Posts: n/a
Default Re: Forms and cancelling updates

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Seems easy to me:

const strMSG = "Do you want to save?"

dim intAnswer as integer

intAnswer = MsgBox(strMSG, vbInformation + vbYesNoCancel)

Select Case intAnswer
Case vbYes
DoCmd.RunCommand acCmdSave
Case vbNo
Me.Undo
Case vbCancel
' Don't do anything
End Select


If Cancel is selected - that means cancel the save and cancel close -
in effect - Don't Do Anything.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQAwuPYechKqOuFEgEQKfegCfWabiRAjNRe2LFoq8qPiQbm bB0cUAoIt5
/S21b/pu47hctjfyqbpPieWA
=OlBD
-----END PGP SIGNATURE-----


Samuel Hon wrote:
[color=blue]
> Hi All
>
> I'm trying to add an Save/Cancel feature to my forms so that users can
> make changes and then reverse them if they so decide.
>
> I've disabled the close button and blocked the Alt-F4 combination so
> that the only way to exit the form is to the use the Save/Cancel
> buttons
>
> The Save button is straight-forward using DoCmd.Close....
>
> However, the Cancel button is proving to be a bit of a pig. I'm using
> ideas from
> http://support.microsoft.com/?kbid=197103
> but it doesnt mention a Cancel so I'm using
>
> MsgBox("Do you want to save?", vbInformation + vbYesNoCancel, "Save
> Record")
>
> The Yes/No is easy to do, but the vbCancel response is not. As one of
> the guys says in
> http://www.experts-exchange.com/Data..._20810844.html
>
> "if you close the form and hit Cancel and the record is in reality
> saved. " ... "in the meantime you will get the message box but if you
> hit no you will be stuck with the record that was saved when you hit
> cancel."
>
> Does anyone have any ideas on how to implement a decent cancel
> rountine?
>
> Thanks in advance
>
> Sam[/color]

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.