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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overriding a custom Message Box

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
Well after I decided that I will run a On Time Event Procedure to Quit the Access Application each night after a certain hour, if the user did not close the DB before he left work.

My Question is:

If everytime I close the Main Form the user is prompted "Are you sure you want to quit?"

How can I override this prompt and quit!!

 
Prior to running the DoCmd.Quit, you should be able to solve this with:

DoCmd.SetWarnings False

This turns off warnings to the users.... It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution. [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
I cannot set warnings to off because I need the message for the regular user, and This prompt happens in the On Unload Event Procedure!!

So is there another solution!!
 
In the code you are using to Quit the database....you should have a line like:

DoCmd.Quit

In order to turn off the warnings for this event, change that one line to these three lines...

DoCmd.SetWarnings Flase
DoCmd.Quit
DoCmd.SetWarnings True

This will disable the warnings only for that action....This seems to me the best solution for your situation.... It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution. [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
Robert!!

Well, I did exactly what you wrote:

I set the DoCmd.SetWarnings False

However it does not quit Access only after I answer the prompt.

That means the following even if answer no it will quit the program, "BUT" the prompt will not let the Application Close.

What I understand is:

that when I SetWarnings in an OnTime Event Procedure, even though it is set to False, it does not effect something in OnLoad Event Procedure, so since I prompt the user in the OnUnload, the OnTimer cannot override that prompt even with SetWarnings to False.

I Might be Wrong, but I am willing to learn.

What I am thinking of doing is setting a flag in the OnTimer Even Procedure that will populate a Unbound Text Box to a certain Value, and in the OnLoad if that value is true it will not prompt.

If you have an easier softer way let me know!!

Thanks in Advance;

 
That sounds like a solution to me.......try it and see what happens.... It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution. [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top