Exit Button Msg Box Command Help

davin2929

Board Regular
Joined
Oct 13, 2002
Messages
129
Hello all. I need assistance when I click a command button (exit) on a form
I would like a message box to come up and ask "are you sure you want to exit access" Yes/No. if yes exit access if no go back to the form. i've done a search in the message board but i can't find something this simple. any help would be great. thanks.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Perhaps something like this.
Code:
Private Sub Command1_Click()
Dim AskQuit

    AskQuit = MsgBox("Are you sure you want to exit access?", vbYesNo, "Quit")
    
    If AskQuit = vbYes Then
        Application.Quit
    End If
    
End Sub
 
Upvote 0
that worked but it closed access without asking if i wanted to save anything i had open. i want it to ask if i want to save any changes. any suggestions.
 
Upvote 0
access normalls saves automatically, so you dont actually need to save when you exit, about the only thing that you need to save when you exit is when you either make changes to a table (the design and layout) and the same with forms, queries, reports, etc. When you enter data, it saves automatically.
 
Upvote 0
tails said:
access normalls saves automatically, so you dont actually need to save when you exit, about the only thing that you need to save when you exit is when you either make changes to a table (the design and layout) and the same with forms, queries, reports, etc. When you enter data, it saves automatically.

This strange saving behaviour is apparently peculiar to Access. Does anybody know what the logic or reason for this is !!??

Jaafar.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top