Close App. with a MessageBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I do a close app. using DoCmd.Quit with a MSGBOX saying "Are you sure
you want to close Application?".
 
How can I do a close app. using DoCmd.Quit with a MSGBOX saying "Are you sure
you want to close Application?".

If MsgBox("Are you sure you want to close the Application",vbYesNo) =
vbYes then
DoCmd.Quit
End If
 
fredg said:
If MsgBox("Are you sure you want to close the Application",vbYesNo) =
vbYes then
DoCmd.Quit
End If

In the event that you're trying to stop accidental shutdown of the
application, have a form that's always open (it needn't be visible). In that
form's Unload event, put:

If MsgBox("Are you sure you want to close the Application?",vbYesNo) <>
vbYes then
Cancel = True
End If
 
This is the current Form Code Argument.

' Exit the application.
Case conCmdExitApplication
DoCmd.Quit

Is this how the new Argurment with the MsgBox should be?

' Exit the application.
Case conCmdExitApplication
If MsgBox("Are you sure you want to close the Application",vbYesNo) =
vbYes then
DoCmd.Quit
 
This is the current Form Code Argument.

' Exit the application.
Case conCmdExitApplication
DoCmd.Quit

Is this how the new Argurment with the MsgBox should be?

' Exit the application.
Case conCmdExitApplication
If MsgBox("Are you sure you want to close the Application",vbYesNo) =
vbYes then
DoCmd.Quit

Don't forget to add the End if after DoCmd.Quit.

Case conCmdExitApplication
If MsgBox("Are you sure you want to close the Application",vbYesNo) =
vbYes then
DoCmd.Quit
END IF
 
Hi Douglas,

How do you make a form invisible when you open the application? I have a
form that opens as startup and I want to prevent users to accidently click
the application with the red (X). I have a button on the startup form to ask
user if they want to exit application. thanks.
 
You'll need to use the AutoExec macro.

You can either have it call a function, and have the function use the
DoCmd.OpenForm method (setting the window mode to acHidden), or you can have
the AutoExec function open your form (again, setting the window mode to
Hidden).

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"E-mail report using Lotus Notes rather t"
 

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

Back
Top