save automatically on form close

J

Jeff

Hi all,
Is there a way to save the form from run mode when the form is closed
(hide the prompt asking yes, no, cancel).


Thx
 
J

Jeff

either use ctrl+w or click the close button on the upper right corner of the
form. thx
 
K

Klatuu

Can't do it from there. Normally, you would have a close button on the form
and the code would go there. If you don't want to see the message then in
the Open event of the form:
docmd.SetWarnings False
 
J

Jeff

but if i choose not to display the warning, will it default to yes, or no?
also, by setting warning to false, it'll turn off every warning. I m only
interested in saving the design automatically without prompting the user.
 
K

Klatuu

Therein lies the problem. Setting Warnings off will supress all warnings,
and act as if you answered yes to every occurance.
There are two problems I have with your design:
1. I never put the close icon on a form so it has to be closed via my
command button.
2. I never allow changes to a form by a user. You don't know what state it
will be in when you open it the next time.
But, these are subjective opinions not to be confused with the "correct" way.
 
R

Rick Brandt

Jeff said:
but if i choose not to display the warning, will it default to yes,
or no? also, by setting warning to false, it'll turn off every
warning. I m only interested in saving the design automatically
without prompting the user.

Why would a user be making design changes to the form in the first place?
Are you just talking about filters and such?
 
V

Van T. Dinh

Be carefully here: Do you want to save the data currently displayed on the
Form or the *design* of the Form?
 
P

Pete Merenda

I entered a question a couple of hours ago under 'General' entitled 'Error
encountered while saving.' Despite seeing the msg when saving new records,
my data saves to tables correctly.

So, even though I see it's not recommended, I've chosen to use this tip to
hide warnings, however it's not running. I'm using:
DoCmd.SetWarnings = False

on the form's Open event, however, I'm getting a compile error "argument not
optional" highlighting the "SetWarnings" phrase.

Can you offer suggestions on syntax please?
 
Top