Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set warnings question

Status
Not open for further replies.

cainemart

Programmer
Nov 28, 2001
70
US
If you set warning=False and set hourglass to T in your code and have an error statement like
Form_Open_Exit:
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub

Do you have to reverse the initial settings in the body of the form or does Access go to Form_Open_Exit everytime it exits?

I normally reverse it before the error handling code and then also include it in the exit tag, but I am reviewing someone elses code and they just do it in the exit part.

Thanks[fumanchu]
 
You can do it just in the exit portion of your code as long as your error handler (as well as all other methods of exit) point to your exit point. For instance you would not want to use an Exit Sub, but rather GoTo Form_Open_Exit.

By the way, putting your cleanup code in just one place is considered better. That way when you need to change it you only need to update one spot and don't have to worry about several places to change. Also, it generally results in cleaner, easier to debug, code. "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top