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!

exit button

Status
Not open for further replies.

arobbo

IS-IT--Management
Joined
Feb 15, 2005
Messages
62
Location
GB
Does anyone know of a good way to have a button that exits access.

The exit application button leaves access still open, i'd like a button that when clicked exits access.

Anyone got any ideas ?

Cheers

Andy
 
Take a look at the Application.Quit method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thats great thank you.

I'm not too hot on VB, have got it working for a button, but i would really like to work from a switchboard option. There is an option for a switchboard option to "run code" it then asks for function name.

In the standard VBA editing screen i've created a new Function as follows

Function exitAccess()

Application.quit

End Function

and then in the switchboard when it asks for a function name have put in exitAccess


its not working, any ideas ?
 
Are you looking for a code that ask user to quit or not? If yes it is below.
Code:
Private Sub cmdExit_Click()
    On Error GoTo Err_cmdExit_Click
    Dim intResponse As Integer
    Dim strPrompt As String
    strPrompt = "Are you sure you want to Quit the Database?"
    intResponse = MsgBox(strPrompt, vbQuestion + vbYesNo, "My DB Name")
    If intResponse = vbYes Then    
        DoCmd.Quit
    Else
Exit_cmdExit_Click:
        Exit Sub
Err_cmdExit_Click:
        MsgBox err.Description
        Resume Exit_cmdExit_Click
    End If
End Sub
or a simple version...
Code:
Private Sub cmdExit_Click()
    If MsgBox("Are you sure you want to Quit the Database?" _
              , vbYesNo + vbQuestion, "My DB Name") = vbYes Then
        DoCmd.Quit
    End If
End Sub

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Thats great thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top