Form close events and design view

J

Jeff Hunt

Do any of the events that trigger when closing a form (unload, close, etc)
fire when you put a form into design view? I have a main form that is
basically a switchboard, and on load I have docmd.setwarnings false (this way
all subsequent actions have no warnings). On unload of the form I set the
warnings back to true. Since I am still creating the database I go to design
view frequently, but it doesn’t seem to turn the warnings back on unless I
actually close the form. I’d like to be able to switch back and forth from
between design view and form view but not have other objects save without
prompting when I do this.

Thanks.

....jeff...
 
F

fredg

Do any of the events that trigger when closing a form (unload, close, etc)
fire when you put a form into design view? I have a main form that is
basically a switchboard, and on load I have docmd.setwarnings false (this way
all subsequent actions have no warnings). On unload of the form I set the
warnings back to true. Since I am still creating the database I go to design
view frequently, but it doesn¢t seem to turn the warnings back on unless I
actually close the form. I¢d like to be able to switch back and forth from
between design view and form view but not have other objects save without
prompting when I do this.

Thanks.

...jeff...

I would strongly suggest you NOT set warnings off and on the way you
are doing it.
Warnings are an important part of the Access interface.
In my opinion, it would be best if ....
1) You not set them on or off at all while you are still developing
the database.
2) When the database is completed and all of those little "gotcha's"
have been resolved, if you need to turn warnings off for a particular
event, turn them on again before you exit that event. It will be much
safer.
 
B

boblarson

Jeff:

Yes, I agree with the others about the SetWarnings. It really isn't good to
disable them completely. But, when you do, be sure to put a
DoCmd.SetWarnings True

as the first line in your error handler so if something errors out you don't
find yourself without warnings.

To answer your main question, yes the events do get fired when going to
design view. The quickest way to check on that is to put a message box in
the event you want to check and see what message boxes come up when you go to
design view.
--
Bob Larson

Tutorials at http://www.btabdevelopment.com

__________________________________
 
J

Jeff Hunt

Thanks, the message box is a good idea. I've done that before to test other
things... can't believe I didn't think of it here.

To all who answered: I'm aware of the problems with the setwarnings false,
and I have a setwarnings true on exiting the main form as well as individual
custom error handlers for all the functions. I can't *not* use it because,
despite being in development, this database goes out to the users regularly
and they freak out when they see the append/update/delete warnings. We've
forgotten to put the warnings changes back into the code after development
often enough that we've quit taking it out each time we make a change.
Still, thank you all for answering.
 
F

fredg

Thanks, the message box is a good idea. I've done that before to test other
things... can't believe I didn't think of it here.

To all who answered: I'm aware of the problems with the setwarnings false,
and I have a setwarnings true on exiting the main form as well as individual
custom error handlers for all the functions. I can't *not* use it because,
despite being in development, this database goes out to the users regularly
and they freak out when they see the append/update/delete warnings. We've
forgotten to put the warnings changes back into the code after development
often enough that we've quit taking it out each time we make a change.
Still, thank you all for answering.

If those are the only warning messages you are 'concerned' about,
instead of
DoCmd.SetWarnings False
DoCmd.OpenQuery
Or...
DoCmd.RunSQL "Update ... etc.."
DoCmd.SetWarnings True

you could simply use, with appropriate error handling:

CurrentDb.Execute "QueryName",dbFailOnError
or...
CurrentDb.Execute "Update ... etc...",dbFailOnError

No need to SetWarnings on or off.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top