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

Code to close Access

Status
Not open for further replies.

kgerlitz

Technical User
Oct 2, 2004
84
US
Is there code that can be put into a command button that will close a database and Access? Thanks in advance
 
kgerlitz,

I believe it is...

DoCmd Quit.

Consult the VBA help text.

Good Luck...
 
Private Sub cmdQuit_Click()
On Error GoTo Err_cmdQuit_Click
If MsgBox("Are you sure you wish to Exit the Database Application?", vbYesNo, "QUIT APPLICATION") = vbYes Then
DoCmd.Quit
Else
End If

Exit_cmdQuit_Click:
Exit Sub

Err_cmdQuit_Click:
MsgBox "Please contact Manager and report issue: " & vbNewLine _
& Err.Number & Err.Description & vbNewLine _
& "cmdQuit Click"
Resume Exit_cmdQuit_Click

End Sub

"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
Application.Quit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have a database that this might come in handy on. A couple differences though. I need it to have a timer so that it closes the database and access on all computers with the database open at a particular time. I don't want it to ask if it's okay to close it. I need it to do it automatically at that time. Is this possible?
 
r10701, create a new topic with what you're looking for. I'm drawing a blank as to how to get it to work across the network at the moment, but maybe someone else can help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top