A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Implementing a Save, Delete or Cancel MsgBox



 
 
Thread Tools Display Modes
  #1  
Old August 5th, 2004, 04:47 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Implementing a Save, Delete or Cancel MsgBox

You need to use the Form_BeforeUpdate Event (of the
Subform) to ask the user whether to save or cancel the
Record currently being edited.

Check Access VB Help on the BeforeUpdate Event of a Form.

When the user moves the Focus from the Subform to the Main
Form, the Record (in the Subform) is also saved
automatically.

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----
I have a subform embedded into a main form. It has some

buttons on it that
allow the user to enter a new record and decide whether

to save it or cancel
it (cmdNew, cmdSave, cmdCancel buttons). The problem is

that the user can
unfortunately do a number of other things that will

bypass the save and
cancel buttons:

1) Close the form.
2) Close the database.
3) Move to another record in the subform by the

navigation buttons.
4) Probably other ways that I haven't discovered.

Any of these things will cause the new record to be saved

probably without
the user realizing it thus allowing bad or incomplete

data into the
database.

How can I implement the sort of Save, Delete or Cancel

MsgBox seen on
Windows applications where before the application is

closed, the MsgBox
arises allowing the user to save or delete prior to

closing or actually
cancel the closing? I tried tying some code to the

OnUnload event but this
doesn't seem to work (the application closes or the form

closes
prematurely).

John


.

  #2  
Old August 19th, 2004, 01:42 PM
???
external usenet poster
 
Posts: n/a
Default


"TC" wrote in message
om...
"Arvin Meyer" wrote in message

...
"TC" wrote in message
...

Sure you can do it by not putting validation in BeforeUpdate events.

You
can
also do it by ensuring that there are never any records in the table.

Or
by
preventing the user from opening the application. Or by locking the PC

in
a
box so the user can not get to it.

My point - surely obvious to most readers - was that all of the usual
attempts to code a Cancel button are doomed to failure, because they

do
not
consider the focus issue that I described. I do not deny that this can

be
solved by ridiculous contortions such as removing all validation code

from
the very event that is designed for managing validation. In that

regard, I
agree that it is not "100% impossible". It is only 100% impossible for
people who like to do weird things such as using bound forms and/or
BeforeUpdate events for validations.



I don't want to argue the point


Neither do I - which is why I started to get heated.


so this will be my last post on the subject.


No point stopping if there is something worth discussing.


Simple Access front-end database applications are usually bound to the

data.
Most other applications are unbound. I prefer bound forms because they

are
easier to build and use ...


Agree 100%.


except under the condition that the edits are
cancellable. If the edits must be cancellable, there is little choice

but to
make unbound forms.


I don't see that. You simply tell your users to press the Esc key when
they want to cancel pending changes. This gives easy cancellation of
pending changes, while retaining the convenience of using bound forms
& having validation in BeforeUpdate events.


Experienced database developers should be comfortable
with both methods, as neither situation is unusual.



Cheers,
TC



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How: delete tables & save text? Stan Tables 6 June 22nd, 2004 07:41 PM
Save and Save as buttons on word 2003 vincent General Discussion 3 June 14th, 2004 03:46 PM
Help! Need to delete table and save text. Bill & Debbie Tables 1 May 22nd, 2004 12:33 AM
JPG > Crop > Save > Degrade? Nehmo Sergheyev General Discussions 5 May 12th, 2004 10:13 AM
how to prompt for action when user clicks save Frank Kabel Worksheet Functions 0 February 20th, 2004 08:31 PM


All times are GMT +1. The time now is 12:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.