totn Access

MS Access 2003: Quit Access using VBA code

This MSAccess tutorial explains how to close down the Access application using VBA code in Access 2003 (with step-by-step instructions).

Question: In Microsoft Access 2003/XP/2000/97, I've created a database and I want to place a button on a form that when clicked will shutdown my Access database?

Answer: In your Access form, you could create a button. On the Click event of this button, you could place the following VBA code:

Private Sub Command1_Click()

   DoCmd.Quit

End Sub

In this example, we've created a button called Command1. When the user clicks this button, the your database will quit and shutdown the session of Access.